From 727196ced2423008bb25d7775c4e3b7fca063c8b Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Thu, 12 Jul 2018 12:09:08 -0400 Subject: Fix FK checks of TRUNCATE involving partitioned tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Michael Paquiër Discussion: https://postgr.es/m/20180711000624.zmeizicibxeehhsg@alvherre.pgsql --- src/backend/commands/tablecmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 7c0cf0d7eea..22e81e712d8 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 -- cgit v1.2.3