BUG #14315: pg_dump --no-tablespaces doesn't do it's job when --create specified

Started by Danylo Hlynskyiover 9 years ago2 messagesbugs
Jump to latest
#1Danylo Hlynskyi
abcz2.uprola@gmail.com

The following bug has been logged on the website:

Bug reference: 14315
Logged by: Danylo Hlynskyi
Email address: abcz2.uprola@gmail.com
PostgreSQL version: 9.5.4
Operating system: Amazon Linux
Description:

I have a database in custom tablespace and I want to pg_dump/pg_restore it
in another place without tablespace.

But I noticed that --no-tablespaces doesn't change --create option to not
include tablespaces:

$ pg_dump -C --schema-only -U postgres -h test --no-tablespaces -d
wp_analytics | grep "CREATE DATABASE"
CREATE DATABASE wp_analytics WITH TEMPLATE = template0 ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE =
wp_tblspc;

I think that it is a bug. If I specify --create and --no-tablespaces
together than "TABLESPACE = wp_tblspc" should be absent in resulting
command.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Danylo Hlynskyi (#1)
Re: BUG #14315: pg_dump --no-tablespaces doesn't do it's job when --create specified

abcz2.uprola@gmail.com writes:

But I noticed that --no-tablespaces doesn't change --create option to not
include tablespaces:

$ pg_dump -C --schema-only -U postgres -h test --no-tablespaces -d
wp_analytics | grep "CREATE DATABASE"
CREATE DATABASE wp_analytics WITH TEMPLATE = template0 ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE =
wp_tblspc;

I think that it is a bug.

Yeah, I think you're right, especially since the corresponding code in
pg_dumpall does suppress the TABLESPACE clause with --no-tablespaces.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs