Re: [HACKERS] Bug in pg_dump --table and --exclude-table fordeclarative partition table handling. - Mailing list pgsql-hackers

From Jeevan Ladhe
Subject Re: [HACKERS] Bug in pg_dump --table and --exclude-table fordeclarative partition table handling.
Date
Msg-id CAOgcT0PPxRsHMMhB0cZY=fC=O9y69tptH5PioHx64DPc9t14zA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Bug in pg_dump --table and --exclude-table fordeclarative partition table handling.  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Responses Re: [HACKERS] Bug in pg_dump --table and --exclude-table for declarative partition table handling.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers


On Thu, May 11, 2017 at 4:47 PM, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote:

We add PARTITION OF clause for a table which is partition, so if the
parent is not present while restoring, the restore is going to fail.

+1
But, similarly for inheritance if we dump a child table, it's dump is broken as
of today. When we dump a child table we append "inherits(parenttab)" clause at
the end of the DDL. Later when we try to restore this table on a database not
having the parenttab, the restore fails.
So, I consider this as a bug.

Consider following example:

postgres=# create table tab1(a int, b int);
CREATE TABLE
postgres=# create table tab2(c int, d char) inherits(tab1);
CREATE TABLE
postgres=# \! pg_dump postgres -t tab2 > a.sql
postgres=# create database bkdb;
CREATE DATABASE
postgres=# \! psql bkdb < a.sql
SET
SET
SET
SET
SET
SET
SET
SET
SET
SET
SET
ERROR:  relation "tab1" does not exist
ERROR:  relation "tab2" does not exist
ERROR:  relation "tab2" does not exist
invalid command \.
postgres=#

Regards,
Jeevan Ladhe 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] alter table..drop constraint pkey, left not null un-dropped
Next
From: Simon Riggs
Date:
Subject: Re: [HACKERS] Time based lag tracking for logical replication