forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf0d65c0
committed
Reject system columns as elements of foreign keys.
Up through v11 it was sensible to use the "oid" system column asa foreign key column, but since that was removed there's no visibleusefulness in making any of the remaining system columns a foreignkey. Moreover, since the TupleTableSlot rewrites in v12, such casesactively fail because of implicit assumptions that only user columnsappear in foreign keys. The lack of complaints about that seemslike good evidence that no one is trying to do it. Hence, ratherthan trying to repair those assumptions (of which there are at leasttwo, maybe more), let's just forbid the case up front.Per this patch, a system column in either the referenced orreferencing side of a foreign key will draw this error; however,putting one in the referenced side would have failed later anyway,since we don't allow unique indexes to be made on system columns.Per bug #17877 from Alexander Lakhin. Back-patch to v12; thecase still appears to work in v11, so we shouldn't break it there.Discussion:https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org1 parentc2d7d67 commitf0d65c0
File tree
3 files changed
+23
-10
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+23
-10
lines changedLines changed: 13 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11271 | 11271 |
| |
11272 | 11272 |
| |
11273 | 11273 |
| |
| 11274 | + | |
| 11275 | + | |
| 11276 | + | |
| 11277 | + | |
| 11278 | + | |
11274 | 11279 |
| |
11275 | 11280 |
| |
11276 | 11281 |
| |
| |||
11284 | 11289 |
| |
11285 | 11290 |
| |
11286 | 11291 |
| |
| 11292 | + | |
11287 | 11293 |
| |
11288 | 11294 |
| |
11289 | 11295 |
| |
11290 | 11296 |
| |
11291 | 11297 |
| |
11292 | 11298 |
| |
11293 | 11299 |
| |
| 11300 | + | |
| 11301 | + | |
| 11302 | + | |
| 11303 | + | |
| 11304 | + | |
11294 | 11305 |
| |
11295 | 11306 |
| |
11296 | 11307 |
| |
11297 | 11308 |
| |
11298 | 11309 |
| |
11299 |
| - | |
| 11310 | + | |
11300 | 11311 |
| |
11301 |
| - | |
| 11312 | + | |
11302 | 11313 |
| |
11303 | 11314 |
| |
11304 | 11315 |
| |
|
Lines changed: 6 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
795 | 795 |
| |
796 | 796 |
| |
797 | 797 |
| |
798 |
| - | |
| 798 | + | |
| 799 | + | |
799 | 800 |
| |
800 | 801 |
| |
801 | 802 |
| |
802 | 803 |
| |
803 |
| - | |
804 |
| - | |
805 |
| - | |
806 |
| - | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
807 | 808 |
| |
808 | 809 |
| |
809 | 810 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
490 | 490 |
| |
491 | 491 |
| |
492 | 492 |
| |
493 |
| - | |
| 493 | + | |
| 494 | + | |
494 | 495 |
| |
495 | 496 |
| |
| 497 | + | |
| 498 | + | |
496 | 499 |
| |
497 |
| - | |
498 |
| - | |
499 | 500 |
| |
500 | 501 |
| |
501 | 502 |
| |
|
0 commit comments
Comments
(0)