forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2f98ece
committed
The brackets aren't put on the CHECK constraints properly.
Before patch:test=# select pg_get_constraintdef(oid) from pg_constraint; pg_get_constraintdef------------------------------------------------------------------------------------------------- CHECK (VALUE >= 0) CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR((a)::text = 'dfd'::text)) PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b)(5 rows)test=# select pg_get_constraintdef(oid, true) from pg_constraint; pg_get_constraintdef----------------------------------------------------------------------------------- CHECK VALUE >= 0 CHECK a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text ='dfd'::text PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b)(5 rows)After patch:test=# select pg_get_constraintdef(oid) from pg_constraint; pg_get_constraintdef------------------------------------------------------------------------------------------------- CHECK (VALUE >= 0) CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR((a)::text = 'dfd'::text)) PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b)(5 rows)test=# select pg_get_constraintdef(oid, true) from pg_constraint; pg_get_constraintdef----------------------------------------------------------------------------------- CHECK (VALUE >= 0)` CHECK (a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text ='dfd'::text) PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b)(5 rows)It's important that those brackets are there to (a) match all otherconstraints and (b) so that people can just copy and paste them and itwill work as SQL.Christopher Kings-Lynne1 parent6000e32 commit2f98ece
1 file changed
+9
-1
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
| 6 | + | |
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
| |||
1056 | 1056 |
| |
1057 | 1057 |
| |
1058 | 1058 |
| |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1059 | 1063 |
| |
1060 | 1064 |
| |
1061 | 1065 |
| |
| |||
1094 | 1098 |
| |
1095 | 1099 |
| |
1096 | 1100 |
| |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1097 | 1105 |
| |
1098 | 1106 |
| |
1099 | 1107 |
| |
|
0 commit comments
Comments
(0)