Re: TRUNCATE tables referenced by FKs on partitioned tables

2018-07-12 Thread Alvaro Herrera
On 2018-Jul-12, Michael Paquier wrote: > On Wed, Jul 11, 2018 at 06:59:16PM -0400, Alvaro Herrera wrote: > > Anyway, this patch seems to fix it, and adds what I think is appropriate > > test coverage. > > This looks good to me. I am noticing that the documentation of TRUNCATE > does not mention

Re: TRUNCATE tables referenced by FKs on partitioned tables

2018-07-11 Thread Michael Paquier
On Wed, Jul 11, 2018 at 06:59:16PM -0400, Alvaro Herrera wrote: > Anyway, this patch seems to fix it, and adds what I think is appropriate > test coverage. This looks good to me. I am noticing that the documentation of TRUNCATE does not mention that when running the command on a partitioned

Re: TRUNCATE tables referenced by FKs on partitioned tables

2018-07-11 Thread Alvaro Herrera
On 2018-Jul-11, Michael Paquier wrote: > > alvherre=# truncate table prim, partfk; > > ERROR: cannot truncate a table referenced in a foreign key constraint > > DETALLE: Table "partfk" references "prim". > > SUGERENCIA: Truncate table "partfk" at the same time, or use TRUNCATE ... > >

Re: TRUNCATE tables referenced by FKs on partitioned tables

2018-07-11 Thread Michael Paquier
On Tue, Jul 10, 2018 at 08:06:24PM -0400, Alvaro Herrera wrote: > You can't truncate prim on its own. This is expected. > alvherre=# truncate table prim, partfk; > ERROR: cannot truncate a table referenced in a foreign key constraint > DETALLE: Table "partfk" references "prim". > SUGERENCIA:

TRUNCATE tables referenced by FKs on partitioned tables

2018-07-10 Thread Alvaro Herrera
$subject is broken: create table prim (a int primary key); create table partfk (a int references prim) partition by range (a); create table partfk1 partition of partfk for values from (0) to (100); create table partfk2 partition of partfk for values from (100) to (200); You can't truncate prim