Skip to content

Commit ba6b87f

Browse files
committed
Fix pg_dump and pg_dumpall for new names of built-in tablespaces,
per Chris K-L.
1 parent f5f448f commit ba6b87f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.375 2004/06/18 06:14:00 tgl Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.376 2004/06/21 13:36:41 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -1252,7 +1252,7 @@ dumpDatabase(Archive *AH)
12521252
appendPQExpBuffer(creaQry, " ENCODING = ");
12531253
appendStringLiteral(creaQry, encoding, true);
12541254
}
1255-
if (strlen(tablespace) > 0 && strcmp(tablespace, "default") != 0)
1255+
if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0)
12561256
{
12571257
appendPQExpBuffer(creaQry, " TABLESPACE = %s", fmtId(tablespace));
12581258
}

src/bin/pg_dump/pg_dumpall.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.42 2004/06/18 06:14:00 tgl Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.43 2004/06/21 13:36:42 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -426,14 +426,14 @@ dumpTablespaces(PGconn *conn)
426426
printf("--\n-- Tablespaces\n--\n\n");
427427

428428
/*
429-
* Get all tablespaces except for the system default and global
430-
* tablespaces
429+
* Get all tablespaces except built-in ones (which we assume are named
430+
* pg_xxx)
431431
*/
432432
res = executeQuery(conn, "SELECT spcname, "
433433
"pg_catalog.pg_get_userbyid(spcowner) AS spcowner, "
434434
"spclocation, spcacl "
435435
"FROM pg_catalog.pg_tablespace "
436-
"WHERE spcname NOT IN ('default', 'global')");
436+
"WHERE spcname NOT LIKE 'pg\\_%'");
437437

438438
for (i = 0; i < PQntuples(res); i++)
439439
{
@@ -511,7 +511,7 @@ dumpCreateDB(PGconn *conn)
511511
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
512512
"pg_encoding_to_char(d.encoding), "
513513
"datistemplate, datacl, "
514-
"'default' AS dattablespace "
514+
"'pg_default' AS dattablespace "
515515
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
516516
"WHERE datallowconn ORDER BY 1");
517517
else if (server_version >= 70100)
@@ -522,7 +522,7 @@ dumpCreateDB(PGconn *conn)
522522
"(select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
523523
"pg_encoding_to_char(d.encoding), "
524524
"datistemplate, '' as datacl, "
525-
"'default' AS dattablespace "
525+
"'pg_default' AS dattablespace "
526526
"FROM pg_database d "
527527
"WHERE datallowconn ORDER BY 1");
528528
else
@@ -537,7 +537,7 @@ dumpCreateDB(PGconn *conn)
537537
"pg_encoding_to_char(d.encoding), "
538538
"'f' as datistemplate, "
539539
"'' as datacl, "
540-
"'default' AS dattablespace "
540+
"'pg_default' AS dattablespace "
541541
"FROM pg_database d "
542542
"ORDER BY 1");
543543
}
@@ -576,7 +576,7 @@ dumpCreateDB(PGconn *conn)
576576
appendStringLiteral(buf, dbencoding, true);
577577

578578
/* Output tablespace if it isn't default */
579-
if (strcmp(dbtablespace, "default") != 0)
579+
if (strcmp(dbtablespace, "pg_default") != 0)
580580
appendPQExpBuffer(buf, " TABLESPACE = %s",
581581
fmtId(dbtablespace));
582582

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy