pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #12730: pg_dump produces trailing spaces
3+ messages / 2 participants
[nested] [flat]

* BUG #12730: pg_dump produces trailing spaces
@ 2015-02-02 14:31 hans@matfyz.cz
  2015-04-28 23:40 ` Re: BUG #12730: pg_dump produces trailing spaces Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: hans@matfyz.cz @ 2015-02-02 14:31 UTC (permalink / raw)
  To: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #12730: pg_dump produces trailing spaces
  2015-02-02 14:31 BUG #12730: pg_dump produces trailing spaces hans@matfyz.cz
@ 2015-04-28 23:40 ` Bruce Momjian <bruce@momjian.us>
  2015-05-11 15:46   ` Re: BUG #12730: pg_dump produces trailing spaces Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2015-04-28 23:40 UTC (permalink / raw)
  To: hans@matfyz.cz; +Cc: pgsql-bugs

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. +

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

Attachments:

pg_dump.diff (text/x-diff, 643B) download diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c new file mode 100644 index ca427de..f9b564e *** a/src/bin/pg_dump/pg_backup_archiver.c --- b/src/bin/pg_dump/pg_backup_archiver.c *************** _printTocEntry(ArchiveHandle *AH, TocEnt *** 3246,3252 **** free(sanitized_schema); free(sanitized_owner); ! if (te->tablespace && !ropt->noTablespace) { char *sanitized_tablespace; --- 3246,3252 ---- free(sanitized_schema); free(sanitized_owner); ! if (te->tablespace && strlen(te->tablespace) > 0 && !ropt->noTablespace) { char *sanitized_tablespace;
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: BUG #12730: pg_dump produces trailing spaces
  2015-02-02 14:31 BUG #12730: pg_dump produces trailing spaces hans@matfyz.cz
  2015-04-28 23:40 ` Re: BUG #12730: pg_dump produces trailing spaces Bruce Momjian <bruce@momjian.us>
@ 2015-05-11 15:46   ` Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2015-05-11 15:46 UTC (permalink / raw)
  To: hans@matfyz.cz; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2015-05-11 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-02-02 14:31 BUG #12730: pg_dump produces trailing spaces hans@matfyz.cz
2015-04-28 23:40 ` Bruce Momjian <bruce@momjian.us>
2015-05-11 15:46   ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox