Current HEAD creates dumps that can't be loaded

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Current HEAD creates dumps that can't be loaded

hubert depesz lubaczewski-2
Hi,
I tested commit 9f8b717a80c59e4a8e8091a8ff6c6f7666a69c33 on my computer.
Version string: PostgreSQL 12devel on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

To test, I created simple partitioned table:

------------------
CREATE TABLE users ( username text PRIMARY KEY, password text ) PARTITION BY HASH ( username );
CREATE TABLE users_0 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 0);
CREATE TABLE users_1 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 1);
CREATE TABLE users_2 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 2);
CREATE TABLE users_3 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 3);
CREATE TABLE users_4 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 4);
CREATE TABLE users_5 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 5);
CREATE TABLE users_6 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 6);
CREATE TABLE users_7 partition OF users FOR VALUES WITH (MODULUS 8, REMAINDER 7);
------------------

Then, I made two dumps:

pg_dump > dump.plain.sql
pg_dump -Fd -f dump.dir

Then, I tried to load the dumps to another database, using:

dropdb test; createdb test; psql -d test -f dump.plain.sql -qAtX &> dump.plain.log
dropdb test; createdb test; pg_restore -d test -Fd dump.dir/ &> dump.dir.log

Both restores failed!

Plain had errors like:
ERROR:  column "username" in child table must be marked NOT NULL
ERROR:  cannot attach index "users_0_pkey" as a partition of index "users_pkey"

And the dir based:
ERROR:  column "username" in child table must be marked NOT NULL
ERROR:  relation "public.users_X" does not exist
ERROR:  relation "public.users_X_pkey" does not exist

Full dumps and logs are available here:
https://www.depesz.com/various/pg-bug-2019-04-30/test.dumps.tar.gz

Best regards,

depesz