pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Reject system columns as elements of foreign keys. 5+ messages / 1 participants [nested] [flat]
* pgsql: Reject system columns as elements of foreign keys. @ 2023-03-31 15:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2023-03-31 15:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject system columns as elements of foreign keys. Up through v11 it was sensible to use the "oid" system column as a foreign key column, but since that was removed there's no visible usefulness in making any of the remaining system columns a foreign key. Moreover, since the TupleTableSlot rewrites in v12, such cases actively fail because of implicit assumptions that only user columns appear in foreign keys. The lack of complaints about that seems like good evidence that no one is trying to do it. Hence, rather than trying to repair those assumptions (of which there are at least two, maybe more), let's just forbid the case up front. Per this patch, a system column in either the referenced or referencing 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; the case still appears to work in v11, so we shouldn't break it there. Discussion: https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b0b55d8b80d46bcb4b38702618ca5872cf6daaf1 Modified Files -------------- src/backend/commands/tablecmds.c | 15 +++++++++++++-- src/test/regress/expected/foreign_key.out | 11 ++++++----- src/test/regress/sql/foreign_key.sql | 7 ++++--- 3 files changed, 23 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Reject system columns as elements of foreign keys. @ 2023-03-31 15:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2023-03-31 15:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject system columns as elements of foreign keys. Up through v11 it was sensible to use the "oid" system column as a foreign key column, but since that was removed there's no visible usefulness in making any of the remaining system columns a foreign key. Moreover, since the TupleTableSlot rewrites in v12, such cases actively fail because of implicit assumptions that only user columns appear in foreign keys. The lack of complaints about that seems like good evidence that no one is trying to do it. Hence, rather than trying to repair those assumptions (of which there are at least two, maybe more), let's just forbid the case up front. Per this patch, a system column in either the referenced or referencing 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; the case still appears to work in v11, so we shouldn't break it there. Discussion: https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6e369817367cc3a9d0db368383a4430733883142 Modified Files -------------- src/backend/commands/tablecmds.c | 15 +++++++++++++-- src/test/regress/expected/foreign_key.out | 11 ++++++----- src/test/regress/sql/foreign_key.sql | 7 ++++--- 3 files changed, 23 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Reject system columns as elements of foreign keys. @ 2023-03-31 15:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2023-03-31 15:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject system columns as elements of foreign keys. Up through v11 it was sensible to use the "oid" system column as a foreign key column, but since that was removed there's no visible usefulness in making any of the remaining system columns a foreign key. Moreover, since the TupleTableSlot rewrites in v12, such cases actively fail because of implicit assumptions that only user columns appear in foreign keys. The lack of complaints about that seems like good evidence that no one is trying to do it. Hence, rather than trying to repair those assumptions (of which there are at least two, maybe more), let's just forbid the case up front. Per this patch, a system column in either the referenced or referencing 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; the case still appears to work in v11, so we shouldn't break it there. Discussion: https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bfb993b1bbd137b5ea0a4f14bddd57ac46dac494 Modified Files -------------- src/backend/commands/tablecmds.c | 15 +++++++++++++-- src/test/regress/expected/foreign_key.out | 11 ++++++----- src/test/regress/sql/foreign_key.sql | 7 ++++--- 3 files changed, 23 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Reject system columns as elements of foreign keys. @ 2023-03-31 15:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2023-03-31 15:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject system columns as elements of foreign keys. Up through v11 it was sensible to use the "oid" system column as a foreign key column, but since that was removed there's no visible usefulness in making any of the remaining system columns a foreign key. Moreover, since the TupleTableSlot rewrites in v12, such cases actively fail because of implicit assumptions that only user columns appear in foreign keys. The lack of complaints about that seems like good evidence that no one is trying to do it. Hence, rather than trying to repair those assumptions (of which there are at least two, maybe more), let's just forbid the case up front. Per this patch, a system column in either the referenced or referencing 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; the case still appears to work in v11, so we shouldn't break it there. Discussion: https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f0d65c0eaf05d6acd3ae05cde4a31465eb3992b2 Modified Files -------------- src/backend/commands/tablecmds.c | 15 +++++++++++++-- src/test/regress/expected/foreign_key.out | 11 ++++++----- src/test/regress/sql/foreign_key.sql | 7 ++++--- 3 files changed, 23 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Reject system columns as elements of foreign keys. @ 2023-03-31 15:19 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2023-03-31 15:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject system columns as elements of foreign keys. Up through v11 it was sensible to use the "oid" system column as a foreign key column, but since that was removed there's no visible usefulness in making any of the remaining system columns a foreign key. Moreover, since the TupleTableSlot rewrites in v12, such cases actively fail because of implicit assumptions that only user columns appear in foreign keys. The lack of complaints about that seems like good evidence that no one is trying to do it. Hence, rather than trying to repair those assumptions (of which there are at least two, maybe more), let's just forbid the case up front. Per this patch, a system column in either the referenced or referencing 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; the case still appears to work in v11, so we shouldn't break it there. Discussion: https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e8d74aac522a41e605d8f19fa1947fb118d43011 Modified Files -------------- src/backend/commands/tablecmds.c | 15 +++++++++++++-- src/test/regress/expected/foreign_key.out | 11 ++++++----- src/test/regress/sql/foreign_key.sql | 7 ++++--- 3 files changed, 23 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2023-03-31 15:19 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-03-31 15:19 pgsql: Reject system columns as elements of foreign keys. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-31 15:19 pgsql: Reject system columns as elements of foreign keys. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-31 15:19 pgsql: Reject system columns as elements of foreign keys. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-31 15:19 pgsql: Reject system columns as elements of foreign keys. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-31 15:19 pgsql: Reject system columns as elements of foreign keys. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox