1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

Issue 'SET check_function_bodies = false' to suppress possible restore

failures in SQL functions, due to forward references or unqualified
references to objects in other schemas.  Per recent discussion.
This commit is contained in:
Tom Lane
2003-10-03 20:10:59 +00:00
parent 15c194c1d5
commit ef88199f61
3 changed files with 19 additions and 10 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.77 2003/09/23 23:31:52 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.78 2003/10/03 20:10:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1708,6 +1708,7 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
AH->currUser = strdup(""); /* So it's valid, but we can free() it
* later if necessary */
AH->currSchema = strdup(""); /* ditto */
AH->chk_fn_bodies = true; /* assumed default state */
AH->toc = (TocEntry *) calloc(1, sizeof(TocEntry));
if (!AH->toc)
@ -2103,6 +2104,8 @@ _reconnectToDB(ArchiveHandle *AH, const char *dbname, const char *user)
if (AH->currSchema)
free(AH->currSchema);
AH->currSchema = strdup("");
AH->chk_fn_bodies = true; /* assumed default state */
}
/*
@ -2198,6 +2201,13 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
_becomeOwner(AH, te);
_selectOutputSchema(AH, te->namespace);
/* If it's a function, make sure function checking is disabled */
if (AH->chk_fn_bodies && strcmp(te->desc, "FUNCTION") == 0)
{
ahprintf(AH, "SET check_function_bodies = false;\n\n");
AH->chk_fn_bodies = false;
}
if (isData)
pfx = "Data for ";
else