pg_dump: Too much <SPACE> in COPY ouput
pg_dump: Too much <SPACE> in COPY ouput
От:
pgsql-bugs@postgresql.org
Дата:
Jean-Francois Leveque (leveque@webmails.com) reports a bug with a severity of 4 The lower the number the more severe it is. Short Description pg_dump: Too much in COPY ouput Long Description System: SuSE 7.0 select version(); : PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC 2.95.2 pg_dump inserts an extra between double-quoted tablename and FROM. This was not the case with the version I used before: System: SuSE 7.0 PostgreSQL RPM: postgres-7.0.2-29 select version(); : PostgreSQL 7.0.2 on i686-pc-linux-gnu, compiled by gcc 2.95.2 Example form two pg_dump outputs 7.1.2 : COPY "list" FROM stdin; 7.0.2 : COPY "list" FROM stdin; Sample Code No file was uploaded with this report
Re: pg_dump: Too much <SPACE> in COPY ouput
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
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... regards, tom lane
Re: pg_dump: Too much <SPACE> in COPY ouput
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
> 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;
}