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

Commit36a1e73

Browse files
committed
Rework pg_dump namespace search criteria so that dumping of user objects
having names conflicting with system objects will work --- the searchpath is now user-schema, pg_catalog rather than implicitly the other wayaround. Note this requires being careful to explicitly qualify referencesto system names whenever pg_catalog is not first in the search path.Also, add support for dumping ACLs of schemas.
1 parent5a8ab29 commit36a1e73

File tree

3 files changed

+350
-160
lines changed

3 files changed

+350
-160
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.46 2002/05/10 22:36:26 tgl Exp $
18+
*$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.47 2002/05/28 22:26:56 tgl Exp $
1919
*
2020
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2121
*
@@ -2097,33 +2097,39 @@ _reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te)
20972097
staticvoid
20982098
_selectOutputSchema(ArchiveHandle*AH,constchar*schemaName)
20992099
{
2100+
PQExpBufferqry;
2101+
21002102
if (!schemaName||*schemaName=='\0'||
21012103
strcmp(AH->currSchema,schemaName)==0)
21022104
return;/* no need to do anything */
21032105

2106+
qry=createPQExpBuffer();
2107+
2108+
appendPQExpBuffer(qry,"SET search_path = %s",
2109+
fmtId(schemaName, false));
2110+
if (strcmp(schemaName,"pg_catalog")!=0)
2111+
appendPQExpBuffer(qry,", pg_catalog");
2112+
21042113
if (RestoringToDB(AH))
21052114
{
2106-
PQExpBufferqry=createPQExpBuffer();
21072115
PGresult*res;
21082116

2109-
appendPQExpBuffer(qry,"SET search_path = %s;",
2110-
fmtId(schemaName, false));
21112117
res=PQexec(AH->connection,qry->data);
21122118

21132119
if (!res||PQresultStatus(res)!=PGRES_COMMAND_OK)
21142120
die_horribly(AH,modulename,"could not set search_path to %s: %s",
21152121
schemaName,PQerrorMessage(AH->connection));
21162122

21172123
PQclear(res);
2118-
destroyPQExpBuffer(qry);
21192124
}
21202125
else
2121-
ahprintf(AH,"SET search_path = %s;\n\n",
2122-
fmtId(schemaName, false));
2126+
ahprintf(AH,"%s;\n\n",qry->data);
21232127

21242128
if (AH->currSchema)
21252129
free(AH->currSchema);
21262130
AH->currSchema=strdup(schemaName);
2131+
2132+
destroyPQExpBuffer(qry);
21272133
}
21282134

21292135

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp