Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2023-03-30T17:33:40Z
Lists: pgsql-bugs
Attachments
- disallow-system-columns-in-foreign-keys.patch (text/x-diff) patch
Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > On 2023-Mar-29, Tom Lane wrote: >> We should probably just disallow system columns as foreign keys. >> There was a legitimate use-case for that with OID columns, but >> no more. > +1 Seems pretty easy, as attached. The possibly harder question is whether to back-patch this, or to try to fix the problems Alexander identified in the back branches. Some investigation determined that system columns in foreign keys appear to actually work up through v11, which perhaps coincidentally is the last version that allowed the OID system column. v12 and up have the slot_attnum problem that Alexander showed. The lack of complaints about that suggests that nobody is trying to use any other system columns as FKs in production. Nonetheless, it's a bit worrisome to remove a feature-that-used-to-work in stable branches. On balance though, I'd rather block this than promise to make it work in the back branches. I propose applying the attached back to v12, and leaving v11 alone. regards, tom lane
Commits
-
Reject system columns as elements of foreign keys.
- f0d65c0eaf05 16.0 landed
- e8d74aac522a 12.15 landed
- bfb993b1bbd1 13.11 landed
- b0b55d8b80d4 14.8 landed
- 6e369817367c 15.3 landed