pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix failures in validateForeignKeyConstraint's slow path. 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix failures in validateForeignKeyConstraint's slow path. @ 2019-04-06 19:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2019-04-06 19:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix failures in validateForeignKeyConstraint's slow path. The foreign-key-checking loop in ATRewriteTables failed to ignore relations without storage (e.g., partitioned tables), unlike the initial loop. This accidentally worked as long as RI_Initial_Check succeeded, which it does in most practical cases (including all the ones exercised in the existing regression tests :-(). However, if that failed, as for instance when there are permissions issues, then we entered the slow fire-the-trigger-on-each-tuple path. And that would try to read from the referencing relation, and fail if it lacks storage. A second problem, recently introduced in HEAD, was that this loop had been broken by sloppy refactoring for the tableam API changes. Repair both issues, and add a regression test case so we have some coverage on this code path. Back-patch as needed to v11. (It looks like this code could do with additional bulletproofing, but let's get a working test case in place first.) Hadi Moshayedi, Tom Lane, Andres Freund Discussion: https://postgr.es/m/CAK=1=WrnNmBbe5D9sm3t0a6dnAq3cdbF1vXY816j1wsMqzC8bw@mail.gmail.com Discussion: https://postgr.es/m/19030.1554574075@sss.pgh.pa.us Discussion: https://postgr.es/m/20190325180405.jytoehuzkeozggxx%40alap3.anarazel.de Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/46e3442c9ec858071d60a1c0fae2e9868aeaa0c8 Modified Files -------------- src/backend/commands/tablecmds.c | 15 +++++++-------- src/test/regress/expected/foreign_key.out | 26 ++++++++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 25 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix failures in validateForeignKeyConstraint's slow path. @ 2019-04-06 19:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2019-04-06 19:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix failures in validateForeignKeyConstraint's slow path. The foreign-key-checking loop in ATRewriteTables failed to ignore relations without storage (e.g., partitioned tables), unlike the initial loop. This accidentally worked as long as RI_Initial_Check succeeded, which it does in most practical cases (including all the ones exercised in the existing regression tests :-(). However, if that failed, as for instance when there are permissions issues, then we entered the slow fire-the-trigger-on-each-tuple path. And that would try to read from the referencing relation, and fail if it lacks storage. A second problem, recently introduced in HEAD, was that this loop had been broken by sloppy refactoring for the tableam API changes. Repair both issues, and add a regression test case so we have some coverage on this code path. Back-patch as needed to v11. (It looks like this code could do with additional bulletproofing, but let's get a working test case in place first.) Hadi Moshayedi, Tom Lane, Andres Freund Discussion: https://postgr.es/m/CAK=1=WrnNmBbe5D9sm3t0a6dnAq3cdbF1vXY816j1wsMqzC8bw@mail.gmail.com Discussion: https://postgr.es/m/19030.1554574075@sss.pgh.pa.us Discussion: https://postgr.es/m/20190325180405.jytoehuzkeozggxx%40alap3.anarazel.de Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c2a5fb33d104afbe2c4877ddce2689bccd4eb1f1 Modified Files -------------- src/backend/commands/tablecmds.c | 9 +++++++++ src/test/regress/expected/foreign_key.out | 28 +++++++++++++++++++++++++++- src/test/regress/sql/foreign_key.sql | 25 +++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-04-06 19:09 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-04-06 19:09 pgsql: Fix failures in validateForeignKeyConstraint's slow path. Tom Lane <tgl@sss.pgh.pa.us> 2019-04-06 19:09 pgsql: Fix failures in validateForeignKeyConstraint's slow path. 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