BUG #12730: pg_dump produces trailing spaces

Started by Hans Ginzelabout 11 years ago3 messagesbugs
Jump to latest
#1Hans Ginzel
hans@matfyz.cz

The following bug has been logged on the website:

Bug reference: 12730
Logged by: Hans Ginzel
Email address: hans@matfyz.cz
PostgreSQL version: 9.4.0
Operating system: Centos 6.5
Description:

Hello!

Try
pg_dump --format=p --schema=information_schema --schema-only --file=is.sql

It seams there are trailing spaces in the comment line
-- Name: sql_implementation_info; Type: TABLE; Schema: information_schema;
Owner: postgres; Tablespace:

Skip the string '; Tablespace: ' please, if there is no tablespace or put
'-' for the tablespace name in the same way as dash is used for Owner when
the option --no-owner is used.

Regards
Hans

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

#2Bruce Momjian
bruce@momjian.us
In reply to: Hans Ginzel (#1)
Re: BUG #12730: pg_dump produces trailing spaces

On Mon, Feb 2, 2015 at 02:31:16PM +0000, hans@matfyz.cz wrote:

The following bug has been logged on the website:

Bug reference: 12730
Logged by: Hans Ginzel
Email address: hans@matfyz.cz
PostgreSQL version: 9.4.0
Operating system: Centos 6.5
Description:

Hello!

Try
pg_dump --format=p --schema=information_schema --schema-only --file=is.sql

It seams there are trailing spaces in the comment line
-- Name: sql_implementation_info; Type: TABLE; Schema: information_schema;
Owner: postgres; Tablespace:

Skip the string '; Tablespace: ' please, if there is no tablespace or put
'-' for the tablespace name in the same way as dash is used for Owner when
the option --no-owner is used.

I looked into this issue and found that the pg_dump code doesn't handle
cases where the reltablespace == 0 (default). I have modified pg_dump
to test for a zero-length string as well, and this suppresses the
"Tablespace:" field. Patch attached.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachments:

pg_dump.difftext/x-diff; charset=us-asciiDownload+2-2
#3Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#2)
Re: BUG #12730: pg_dump produces trailing spaces

On Tue, Apr 28, 2015 at 07:40:18PM -0400, Bruce Momjian wrote:

Try
pg_dump --format=p --schema=information_schema --schema-only --file=is.sql

It seams there are trailing spaces in the comment line
-- Name: sql_implementation_info; Type: TABLE; Schema: information_schema;
Owner: postgres; Tablespace:

Skip the string '; Tablespace: ' please, if there is no tablespace or put
'-' for the tablespace name in the same way as dash is used for Owner when
the option --no-owner is used.

I looked into this issue and found that the pg_dump code doesn't handle
cases where the reltablespace == 0 (default). I have modified pg_dump
to test for a zero-length string as well, and this suppresses the
"Tablespace:" field. Patch attached.

Patch applied.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

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