Re: pg_dump: Too much in COPY ouput - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: pg_dump: Too much in COPY ouput
Date
Msg-id 200106011609.f51G9Bk21127@candle.pha.pa.us
Whole thread Raw
In response to Re: pg_dump: Too much in COPY ouput  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
> pgsql-bugs@postgresql.org writes:
> > Example form two pg_dump outputs
> > 7.1.2 :
> >     COPY "list"  FROM stdin;
> > 7.0.2 :
> >     COPY "list" FROM stdin;
>
> I have a very hard time considering that a bug...

Looks like an easy fix.  In fact, the coder had a space after WITH OIDS
already, so there is no need for the extra space after the second %s:

    if (oids == true)
        oidsPart = "WITH OIDS ";
    else
        oidsPart = "";
...

    sprintf(copyBuf, "COPY %s %sFROM stdin;\n", fmtId(tblinfo[i].relname, force_quotes),
        oidsPart);

Patch applied.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.210
diff -c -r1.210 pg_dump.c
*** src/bin/pg_dump/pg_dump.c    2001/05/30 14:15:27    1.210
--- src/bin/pg_dump/pg_dump.c    2001/06/01 16:06:45
***************
*** 684,690 ****
              {
                  dumpFn = dumpClasses_nodumpData;
                  /* dumpClasses_nodumpData(fout, classname, oids); */
!                 sprintf(copyBuf, "COPY %s %s FROM stdin;\n", fmtId(tblinfo[i].relname, force_quotes),
                          oidsPart);
                  copyStmt = copyBuf;
              }
--- 684,690 ----
              {
                  dumpFn = dumpClasses_nodumpData;
                  /* dumpClasses_nodumpData(fout, classname, oids); */
!                 sprintf(copyBuf, "COPY %s %sFROM stdin;\n", fmtId(tblinfo[i].relname, force_quotes),
                          oidsPart);
                  copyStmt = copyBuf;
              }

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Trigger causes the server to crash with SEGV
Next
From: Tom Lane
Date:
Subject: Re: Trigger causes the server to crash with SEGV