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

Commitb222867

Browse files
committed
pg_dump should consider information_schema to be a system schema.
Also, tweak -C option (emit CREATE DATABASE command) to emit encodingname rather than encoding number, for consistency with pg_dumpalland better cross-version portability.
1 parentf1f5978 commitb222867

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 14 additions & 6 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.311 2002/12/12 21:03:24 tgl Exp $
15+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.312 2002/12/21 22:45:09 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -762,7 +762,8 @@ selectDumpableNamespace(NamespaceInfo *nsinfo)
762762
*/
763763
if (selectTablename!=NULL)
764764
nsinfo->dump= false;
765-
elseif (strncmp(nsinfo->nspname,"pg_",3)==0)
765+
elseif (strncmp(nsinfo->nspname,"pg_",3)==0||
766+
strcmp(nsinfo->nspname,"information_schema")==0)
766767
nsinfo->dump= false;
767768
else
768769
nsinfo->dump= true;
@@ -1219,7 +1220,8 @@ dumpDatabase(Archive *AH)
12191220

12201221
/* Get the database owner and parameters from pg_database */
12211222
appendPQExpBuffer(dbQry,"select (select usename from pg_user where usesysid = datdba) as dba,"
1222-
" encoding, datpath from pg_database"
1223+
" pg_encoding_to_char(encoding) as encoding,"
1224+
" datpath from pg_database"
12231225
" where datname = ");
12241226
appendStringLiteral(dbQry,datname, true);
12251227

@@ -1258,10 +1260,16 @@ dumpDatabase(Archive *AH)
12581260

12591261
appendPQExpBuffer(creaQry,"CREATE DATABASE %s WITH TEMPLATE = template0",
12601262
fmtId(datname));
1261-
if (strlen(encoding)>0)
1262-
appendPQExpBuffer(creaQry," ENCODING = %s",encoding);
12631263
if (strlen(datpath)>0)
1264-
appendPQExpBuffer(creaQry," LOCATION = '%s'",datpath);
1264+
{
1265+
appendPQExpBuffer(creaQry," LOCATION = ");
1266+
appendStringLiteral(creaQry,datpath, true);
1267+
}
1268+
if (strlen(encoding)>0)
1269+
{
1270+
appendPQExpBuffer(creaQry," ENCODING = ");
1271+
appendStringLiteral(creaQry,encoding, true);
1272+
}
12651273
appendPQExpBuffer(creaQry,";\n");
12661274

12671275
appendPQExpBuffer(delQry,"DROP DATABASE %s;\n",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp