forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitac355d5
committed
Move most of the error checking for foreign-key constraints out of
parse analysis and into the execution code (in tablecmds.c). Thiseliminates a lot of unreasonably complex code that needed to have twoor more execution paths in case it was dealing with a not-yet-createdtable column vs. an already-existing one. The execution code is alwaysdealing with already-created tables and so needs only one case. Thisalso eliminates some potential race conditions (the table wasn't lockedbetween parse analysis and execution), makes it easy to fix the gripeabout wrong referenced-column names generating a misleading error message,and lets us easily add a dependency from the foreign-key constraint tothe unique index that it requires the referenced table to have. (Cf.complaint from Kris Jurka 12-Sep-2002 on pgsql-bugs.)Also, third try at building a deletion mechanism that is not sensitiveto the order in which pg_depend entries are visited. Adding the above-mentioned dependency exposed the folly of what dependency.c had beendoing: it failed for cases where B depends on C while both auto-dependon A. Dropping A should succeed in this case, but was failing if Chappened to be visited before B. It appears the only solution is twoseparate walks over the dependency tree.1 parente303a2d commitac355d5
File tree
10 files changed
+761
-804
lines changed- src
- backend
- catalog
- commands
- parser
- include/catalog
- test/regress/expected
10 files changed
+761
-804
lines changedLines changed: 180 additions & 128 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1342 | 1342 |
| |
1343 | 1343 |
| |
1344 | 1344 |
| |
| 1345 | + | |
1345 | 1346 |
| |
1346 | 1347 |
| |
1347 | 1348 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
693 | 693 |
| |
694 | 694 |
| |
695 | 695 |
| |
| 696 | + | |
696 | 697 |
| |
697 | 698 |
| |
698 | 699 |
| |
|
Lines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
| 56 | + | |
56 | 57 |
| |
57 | 58 |
| |
58 | 59 |
| |
| |||
216 | 217 |
| |
217 | 218 |
| |
218 | 219 |
| |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
219 | 235 |
| |
220 | 236 |
| |
221 | 237 |
| |
|
0 commit comments
Comments
(0)