diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-07-12 12:09:08 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-07-12 12:09:08 -0400 |
commit | cd073d8f7043d047c024f0f213c0e9c31b9c0505 (patch) | |
tree | 9128f8933f12f17274bae74fea6999bcf75a1124 /src/backend/commands | |
parent | 11a3aeeb5e174a3681f674e7e5ec9bbbc6430394 (diff) | |
download | postgresql-cd073d8f7043d047c024f0f213c0e9c31b9c0505.tar.gz |
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
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/tablecmds.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 7c0cf0d7ee..22e81e712d 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -1421,7 +1421,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, Oid *logrelids; /* - * Open, exclusive-lock, and check all the explicitly-specified relations + * Check the explicitly-specified relations. * * In CASCADE mode, suck in all referencing relations as well. This * requires multiple iterations to find indirectly-dependent relations. At |