Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit229d406

Browse files
committed
Move resetting of currSchema to a spot where it's not vulnerable to getting
missed in possible future partial-drop scenarios. Improve comment.Per report from Zoltan Boszormenyi.
1 parent03debe1 commit229d406

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.150 2007/11/2417:45:32 momjian Exp $
18+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.151 2007/11/2420:26:49 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -245,23 +245,24 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
245245
_selectOutputSchema(AH,te->namespace);
246246
/* Drop it */
247247
ahprintf(AH,"%s",te->dropStmt);
248-
if (strcmp(te->desc,"SCHEMA")==0)
249-
{
250-
/*
251-
* If we dropped a schema, we know we are going to be
252-
* creating one later so don't remember the current one
253-
* so we try later. The previous 'search_path' setting
254-
* might have failed because the schema didn't exist
255-
* (and now it certainly doesn't exist), so force
256-
* search_path to be set as part of the next operation
257-
* and it might succeed.
258-
*/
259-
if (AH->currSchema)
260-
free(AH->currSchema);
261-
AH->currSchema=strdup("");
262-
}
263248
}
264249
}
250+
251+
/*
252+
* _selectOutputSchema may have set currSchema to reflect the effect
253+
* of a "SET search_path" command it emitted. However, by now we may
254+
* have dropped that schema; or it might not have existed in the first
255+
* place. In either case the effective value of search_path will not
256+
* be what we think. Forcibly reset currSchema so that we will
257+
* re-establish the search_path setting when needed (after creating
258+
* the schema).
259+
*
260+
* If we treated users as pg_dump'able objects then we'd need to reset
261+
* currUser here too.
262+
*/
263+
if (AH->currSchema)
264+
free(AH->currSchema);
265+
AH->currSchema=strdup("");
265266
}
266267

267268
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp