Re: BUG #1089: pg_restore fails when restoring lo.sql functions from contrib - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1089: pg_restore fails when restoring lo.sql functions from contrib
Date
Msg-id 3922.1078262277@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1089: pg_restore fails when restoring lo.sql functions from contrib  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
List pgsql-bugs
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> Description:        pg_restore fails when restoring lo.sql functions from
> contrib

Hmm.  It looks like the code for dumping CREATE CAST fails if the cast
function is from a schema other than pg_catalog.  I'm amazed we did not
notice this when testing nearby fixes.  Anyway, here is the patch
against 7.4.*.

            regards, tom lane

Index: pg_dump.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.355.2.3
diff -c -r1.355.2.3 pg_dump.c
*** pg_dump.c    24 Feb 2004 03:35:45 -0000    1.355.2.3
--- pg_dump.c    2 Mar 2004 21:09:50 -0000
***************
*** 4083,4090 ****
          if (strcmp(castfunc, "0") == 0)
              appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
          else
!             appendPQExpBuffer(defqry, "WITH FUNCTION %s",
!                           format_function_signature(&finfo[fidx], true));

          if (strcmp(castcontext, "a") == 0)
              appendPQExpBuffer(defqry, " AS ASSIGNMENT");
--- 4083,4098 ----
          if (strcmp(castfunc, "0") == 0)
              appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
          else
!         {
!             /*
!              * Always qualify the function name, in case it is not in
!              * pg_catalog schema (format_function_signature won't qualify it).
!              */
!             appendPQExpBuffer(defqry, "WITH FUNCTION %s.",
!                               fmtId(finfo[fidx].pronamespace->nspname));
!             appendPQExpBuffer(defqry, "%s",
!                               format_function_signature(&finfo[fidx], true));
!         }

          if (strcmp(castcontext, "a") == 0)
              appendPQExpBuffer(defqry, " AS ASSIGNMENT");

pgsql-bugs by date:

Previous
From: Neil Conway
Date:
Subject: Re: BUG #1089: pg_restore fails when restoring lo.sql functions
Next
From: 帅猛
Date:
Subject: 转发: docs on tsearch2