]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Always schema-qualify the name of a function referenced in CREATE CAST.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 2 Mar 2004 21:14:59 +0000 (21:14 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 2 Mar 2004 21:14:59 +0000 (21:14 +0000)
The former coding failed if the cast function was not in the pg_catalog
schema.  How'd this escape detection?

src/bin/pg_dump/pg_dump.c

index 80d566d14544383b0b92603dfe44c40b6fc0197d..1ebe39a25b48f9b5510f82d220353b8d9fffaedb 100644 (file)
@@ -12,7 +12,7 @@
  *     by PostgreSQL
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355.2.3 2004/02/24 03:35:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355.2.4 2004/03/02 21:14:59 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -4083,8 +4083,16 @@ dumpCasts(Archive *fout,
                if (strcmp(castfunc, "0") == 0)
                        appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
                else
-                       appendPQExpBuffer(defqry, "WITH FUNCTION %s",
-                                                 format_function_signature(&finfo[fidx], true));
+               {
+                       /*
+                        * 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");