Skip to content

Commit 0c6e97d

Browse files
committed
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?
1 parent 351cf4d commit 0c6e97d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.365 2004/02/24 03:35:19 tgl Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.366 2004/03/02 21:14:44 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -5080,8 +5080,16 @@ dumpCast(Archive *fout, CastInfo *cast)
50805080
if (!OidIsValid(cast->castfunc))
50815081
appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
50825082
else
5083-
appendPQExpBuffer(defqry, "WITH FUNCTION %s",
5083+
{
5084+
/*
5085+
* Always qualify the function name, in case it is not in pg_catalog
5086+
* schema (format_function_signature won't qualify it).
5087+
*/
5088+
appendPQExpBuffer(defqry, "WITH FUNCTION %s.",
5089+
fmtId(funcInfo->pronamespace->nspname));
5090+
appendPQExpBuffer(defqry, "%s",
50845091
format_function_signature(funcInfo, NULL, true));
5092+
}
50855093

50865094
if (cast->castcontext == 'a')
50875095
appendPQExpBuffer(defqry, " AS ASSIGNMENT");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy