Always schema-qualify the name of a function referenced in CREATE CAST.
authorTom Lane
Tue, 2 Mar 2004 21:14:44 +0000 (21:14 +0000)
committerTom Lane
Tue, 2 Mar 2004 21:14:44 +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 15e1b2bd01057128e1e5ce9acd5cb6679756efe8..47433c1d0298a05b193911beb141b4b16ffcc2ae 100644 (file)
@@ -12,7 +12,7 @@
  * by PostgreSQL
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.365 2004/02/24 03:35:19 tgl Exp $
+ *   $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.366 2004/03/02 21:14:44 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -5080,8 +5080,16 @@ dumpCast(Archive *fout, CastInfo *cast)
    if (!OidIsValid(cast->castfunc))
        appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
    else
-       appendPQExpBuffer(defqry, "WITH FUNCTION %s",
+   {
+       /*
+        * 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(funcInfo->pronamespace->nspname));
+       appendPQExpBuffer(defqry, "%s",
                          format_function_signature(funcInfo, NULL, true));
+   }
 
    if (cast->castcontext == 'a')
        appendPQExpBuffer(defqry, " AS ASSIGNMENT");