Always schema-qualify the name of a function referenced in CREATE CAST.

The former coding failed if the cast function was not in the pg_catalog
schema.  How'd this escape detection?
This commit is contained in:
Tom Lane 2004-03-02 21:14:59 +00:00
parent 819bfac66a
commit f0d32c033a

View File

@ -12,7 +12,7 @@
* by PostgreSQL * by PostgreSQL
* *
* IDENTIFICATION * 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) if (strcmp(castfunc, "0") == 0)
appendPQExpBuffer(defqry, "WITHOUT FUNCTION"); appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
else 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) if (strcmp(castcontext, "a") == 0)
appendPQExpBuffer(defqry, " AS ASSIGNMENT"); appendPQExpBuffer(defqry, " AS ASSIGNMENT");