mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Fix pg_dump and pg_dumpall for new names of built-in tablespaces,
per Chris K-L.
This commit is contained in:
parent
f5f448fb3e
commit
ba6b87f330
@ -12,7 +12,7 @@
|
|||||||
* by PostgreSQL
|
* by PostgreSQL
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.375 2004/06/18 06:14:00 tgl Exp $
|
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.376 2004/06/21 13:36:41 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1252,7 +1252,7 @@ dumpDatabase(Archive *AH)
|
|||||||
appendPQExpBuffer(creaQry, " ENCODING = ");
|
appendPQExpBuffer(creaQry, " ENCODING = ");
|
||||||
appendStringLiteral(creaQry, encoding, true);
|
appendStringLiteral(creaQry, encoding, true);
|
||||||
}
|
}
|
||||||
if (strlen(tablespace) > 0 && strcmp(tablespace, "default") != 0)
|
if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(creaQry, " TABLESPACE = %s", fmtId(tablespace));
|
appendPQExpBuffer(creaQry, " TABLESPACE = %s", fmtId(tablespace));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.42 2004/06/18 06:14:00 tgl Exp $
|
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.43 2004/06/21 13:36:42 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -426,14 +426,14 @@ dumpTablespaces(PGconn *conn)
|
|||||||
printf("--\n-- Tablespaces\n--\n\n");
|
printf("--\n-- Tablespaces\n--\n\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get all tablespaces except for the system default and global
|
* Get all tablespaces except built-in ones (which we assume are named
|
||||||
* tablespaces
|
* pg_xxx)
|
||||||
*/
|
*/
|
||||||
res = executeQuery(conn, "SELECT spcname, "
|
res = executeQuery(conn, "SELECT spcname, "
|
||||||
"pg_catalog.pg_get_userbyid(spcowner) AS spcowner, "
|
"pg_catalog.pg_get_userbyid(spcowner) AS spcowner, "
|
||||||
"spclocation, spcacl "
|
"spclocation, spcacl "
|
||||||
"FROM pg_catalog.pg_tablespace "
|
"FROM pg_catalog.pg_tablespace "
|
||||||
"WHERE spcname NOT IN ('default', 'global')");
|
"WHERE spcname NOT LIKE 'pg\\_%'");
|
||||||
|
|
||||||
for (i = 0; i < PQntuples(res); i++)
|
for (i = 0; i < PQntuples(res); i++)
|
||||||
{
|
{
|
||||||
@ -511,7 +511,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"datistemplate, datacl, "
|
"datistemplate, datacl, "
|
||||||
"'default' AS dattablespace "
|
"'pg_default' AS dattablespace "
|
||||||
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
|
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
|
||||||
"WHERE datallowconn ORDER BY 1");
|
"WHERE datallowconn ORDER BY 1");
|
||||||
else if (server_version >= 70100)
|
else if (server_version >= 70100)
|
||||||
@ -522,7 +522,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"(select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
"(select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"datistemplate, '' as datacl, "
|
"datistemplate, '' as datacl, "
|
||||||
"'default' AS dattablespace "
|
"'pg_default' AS dattablespace "
|
||||||
"FROM pg_database d "
|
"FROM pg_database d "
|
||||||
"WHERE datallowconn ORDER BY 1");
|
"WHERE datallowconn ORDER BY 1");
|
||||||
else
|
else
|
||||||
@ -537,7 +537,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"'f' as datistemplate, "
|
"'f' as datistemplate, "
|
||||||
"'' as datacl, "
|
"'' as datacl, "
|
||||||
"'default' AS dattablespace "
|
"'pg_default' AS dattablespace "
|
||||||
"FROM pg_database d "
|
"FROM pg_database d "
|
||||||
"ORDER BY 1");
|
"ORDER BY 1");
|
||||||
}
|
}
|
||||||
@ -576,7 +576,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
appendStringLiteral(buf, dbencoding, true);
|
appendStringLiteral(buf, dbencoding, true);
|
||||||
|
|
||||||
/* Output tablespace if it isn't default */
|
/* Output tablespace if it isn't default */
|
||||||
if (strcmp(dbtablespace, "default") != 0)
|
if (strcmp(dbtablespace, "pg_default") != 0)
|
||||||
appendPQExpBuffer(buf, " TABLESPACE = %s",
|
appendPQExpBuffer(buf, " TABLESPACE = %s",
|
||||||
fmtId(dbtablespace));
|
fmtId(dbtablespace));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user