pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix FK checks of TRUNCATE involving partitioned tables
4+ messages / 3 participants
[nested] [flat]
* pgsql: Fix FK checks of TRUNCATE involving partitioned tables
@ 2018-07-12 16:26 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 4+ messages in thread
From: Alvaro Herrera @ 2018-07-12 16:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix FK checks of TRUNCATE involving partitioned tables
When truncating a table that is referenced by foreign keys in
partitioned tables, the check to ensure the referencing table are also
truncated spuriously failed. This is because it was relying on
relhastriggers as a proxy for the table having FKs, and that's wrong for
partitioned tables. Fix it to consider such tables separately. There
may be a better way ... but this code is pretty inefficient already.
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Michael Paquiër <michael@paquier.xyz>
Discussion: https://postgr.es/m/20180711000624.zmeizicibxeehhsg@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/cd073d8f7043d047c024f0f213c0e9c31b9c0505
Modified Files
--------------
src/backend/catalog/heap.c | 7 +++-
src/backend/commands/tablecmds.c | 2 +-
src/test/regress/expected/truncate.out | 75 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/truncate.sql | 47 +++++++++++++++++++++
4 files changed, 128 insertions(+), 3 deletions(-)
^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix FK checks of TRUNCATE involving partitioned tables
@ 2018-07-12 16:26 Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-07-14 12:18 ` Re: pgsql: Fix FK checks of TRUNCATE involving partitioned tables Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 4+ messages in thread
From: Alvaro Herrera @ 2018-07-12 16:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix FK checks of TRUNCATE involving partitioned tables
When truncating a table that is referenced by foreign keys in
partitioned tables, the check to ensure the referencing table are also
truncated spuriously failed. This is because it was relying on
relhastriggers as a proxy for the table having FKs, and that's wrong for
partitioned tables. Fix it to consider such tables separately. There
may be a better way ... but this code is pretty inefficient already.
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Michael Paquiër <michael@paquier.xyz>
Discussion: https://postgr.es/m/20180711000624.zmeizicibxeehhsg@alvherre.pgsql
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/727196ced2423008bb25d7775c4e3b7fca063c8b
Modified Files
--------------
src/backend/catalog/heap.c | 7 +++-
src/backend/commands/tablecmds.c | 2 +-
src/test/regress/expected/truncate.out | 75 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/truncate.sql | 47 +++++++++++++++++++++
4 files changed, 128 insertions(+), 3 deletions(-)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Fix FK checks of TRUNCATE involving partitioned tables
2018-07-12 16:26 pgsql: Fix FK checks of TRUNCATE involving partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2018-07-14 12:18 ` Michael Paquier <michael@paquier.xyz>
2018-07-15 00:11 ` Re: pgsql: Fix FK checks of TRUNCATE involving partitioned tables Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 4+ messages in thread
From: Michael Paquier @ 2018-07-14 12:18 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers@lists.postgresql.org
On Thu, Jul 12, 2018 at 04:26:17PM +0000, Alvaro Herrera wrote:
> Fix FK checks of TRUNCATE involving partitioned tables
>
> Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
> Reviewed-by: Michael Paquiër <michael@paquier.xyz>
> Discussion: https://postgr.es/m/20180711000624.zmeizicibxeehhsg@alvherre.pgsql
Just a note, using 'ë' in the first name would be correct, using it in
the family name is not ;)
It doesn't matter much I don't use any accent myself for simplicity.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Fix FK checks of TRUNCATE involving partitioned tables
2018-07-12 16:26 pgsql: Fix FK checks of TRUNCATE involving partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-07-14 12:18 ` Re: pgsql: Fix FK checks of TRUNCATE involving partitioned tables Michael Paquier <michael@paquier.xyz>
@ 2018-07-15 00:11 ` Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 0 replies; 4+ messages in thread
From: Alvaro Herrera @ 2018-07-15 00:11 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org
On 2018-Jul-14, Michael Paquier wrote:
> On Thu, Jul 12, 2018 at 04:26:17PM +0000, Alvaro Herrera wrote:
> > Fix FK checks of TRUNCATE involving partitioned tables
> >
> > Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
> > Reviewed-by: Michael Paquiër <michael@paquier.xyz>
> > Discussion: https://postgr.es/m/20180711000624.zmeizicibxeehhsg@alvherre.pgsql
>
> Just a note, using 'ë' in the first name would be correct, using it in
> the family name is not ;)
Oops, sorry about that, not sure how I managed to do that.
> It doesn't matter much I don't use any accent myself for simplicity.
Well, I like to use foreign character sets where possible ... eg. commit
49124613f134.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2018-07-15 00:11 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 16:26 pgsql: Fix FK checks of TRUNCATE involving partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-07-12 16:26 pgsql: Fix FK checks of TRUNCATE involving partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-07-14 12:18 ` Michael Paquier <michael@paquier.xyz>
2018-07-15 00:11 ` Alvaro Herrera <alvherre@2ndquadrant.com>
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