Skip site navigation (1) Skip section navigation (2)

Re: BUG #1089: pg_restore fails when restoring lo.sql functions from contrib

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jtate(at)mi-corporation(dot)com
Cc: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #1089: pg_restore fails when restoring lo.sql functions from contrib
Date: 2004-03-02 21:17:57
Message-ID: 3922.1078262277@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)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");

In response to

pgsql-bugs by date

Next:From: 帅猛Date: 2004-03-03 02:42:27
Subject: 转发: docs on tsearch2
Previous:From: Neil ConwayDate: 2004-03-02 21:08:37
Subject: Re: BUG #1089: pg_restore fails when restoring lo.sql functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group