BUG #1843: pg_restore -O restores lowercase schemanaam

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG #1843: pg_restore -O restores lowercase schemanaam

Dick Kniep

The following bug has been logged online:

Bug reference:      1843
Logged by:          D.J. Kniep
Email address:      [hidden email]
PostgreSQL version: 7.4.8
Operating system:   Linux (SuSE 9.3)
Description:        pg_restore -O restores lowercase schemanaam
Details:

I make a backup using

pg_dump -f /tmp/dumpdb -F c -Z 5 cvix

When I try to restore this file, it fails with

postgres@linux:/tmp> pg_restore -O -d cvix2 /tmp/dumpdb
pg_restore: [archiver (db)] could not execute query: ERROR:  schema "Lindix"

does not exist

After checking, the schema lindix does exist (Note the lowercase l), but is
empty.

If I turn on statement logging, I see the following when running
pg_restore -O:

CREATE SCHEMA Test;

If I run pg_restore without -O, I see the following:

CREATE SCHEMA "Test" AUTHORIZATION postgres;

Off course this should be
CREATE SCHEMA "Test";

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Reply | Threaded
Open this post in threaded view
|

Re: BUG #1843: pg_restore -O restores lowercase schemanaam

Tom Lane-2
"D.J. Kniep" <[hidden email]> writes:
> Description:        pg_restore -O restores lowercase schemanaam

Thanks for the report.  This bug seems to exist only in the 7.4 branch.
Applied patch is attached if you need it right away.

                        regards, tom lane

Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.79.2.5
diff -c -r1.79.2.5 pg_backup_archiver.c
*** pg_backup_archiver.c 17 May 2005 17:30:53 -0000 1.79.2.5
--- pg_backup_archiver.c 25 Aug 2005 00:09:55 -0000
***************
*** 2256,2262 ****
  */
  if (AH->ropt && AH->ropt->noOwner && strcmp(te->desc, "SCHEMA") == 0)
  {
! ahprintf(AH, "CREATE SCHEMA %s;\n\n\n", te->tag);
  }
  else
  {
--- 2256,2262 ----
  */
  if (AH->ropt && AH->ropt->noOwner && strcmp(te->desc, "SCHEMA") == 0)
  {
! ahprintf(AH, "CREATE SCHEMA %s;\n\n\n", fmtId(te->tag));
  }
  else
  {

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq