Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e554e2b

Browse files
committed
Don't choke when the handler for a procedural language is located in
the pg_catalog schema. Per bug report some months back from Jochem van Dieten.
1 parent 573f8c0 commit e554e2b

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.354 2003/10/21 04:46:28 tgl Exp $
15+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355 2003/10/28 21:05:29 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -3539,36 +3539,34 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
35393539
lanacl = "{=U}";
35403540
}
35413541

3542-
fidx = findFuncByOid(finfo, numFuncs, lanplcallfoid);
3543-
if (fidx < 0)
3544-
{
3545-
write_msg(NULL, "handler procedure for procedural language \"%s\" not found\n",
3546-
lanname);
3547-
exit_nicely();
3548-
}
3549-
3550-
if (strcmp(lanvalidator, "0") != 0)
3551-
{
3552-
vidx = findFuncByOid(finfo, numFuncs, lanvalidator);
3553-
if (vidx < 0)
3554-
{
3555-
write_msg(NULL, "validator procedure for procedural language \"%s\" not found\n",
3556-
lanname);
3557-
exit_nicely();
3558-
}
3559-
}
3560-
35613542
/*
35623543
* Current theory is to dump PLs iff their underlying functions
35633544
* will be dumped (are in a dumpable namespace, or have a
35643545
* non-system OID in pre-7.3 databases). Actually, we treat the
35653546
* PL itself as being in the underlying function's namespace,
35663547
* though it isn't really. This avoids searchpath problems for
35673548
* the HANDLER clause.
3549+
*
3550+
* If the underlying function is in the pg_catalog namespace,
3551+
* we won't have loaded it into finfo[] at all; therefore,
3552+
* treat failure to find it in finfo[] as indicating we shouldn't
3553+
* dump it, not as an error condition. Ditto for the validator.
35683554
*/
3555+
3556+
fidx = findFuncByOid(finfo, numFuncs, lanplcallfoid);
3557+
if (fidx < 0)
3558+
continue;
3559+
35693560
if (!finfo[fidx].pronamespace->dump)
35703561
continue;
35713562

3563+
if (strcmp(lanvalidator, "0") != 0)
3564+
{
3565+
vidx = findFuncByOid(finfo, numFuncs, lanvalidator);
3566+
if (vidx < 0)
3567+
continue;
3568+
}
3569+
35723570
resetPQExpBuffer(defqry);
35733571
resetPQExpBuffer(delqry);
35743572

0 commit comments

Comments
 (0)