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)
426426printf ("--\n-- Tablespaces\n--\n\n" );
427427
428428/*
429- * Get all tablespaces exceptfor the system default and global
430- *tablespaces
429+ * Get all tablespaces exceptbuilt-in ones (which we assume are named
430+ *pg_xxx)
431431 */
432432res = 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 NOTIN ('default', 'global') " );
436+ "WHERE spcname NOTLIKE 'pg\\_%' " );
437437
438438for (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" );
517517else 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" );
528528else
@@ -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)
576576appendStringLiteral (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 )
580580appendPQExpBuffer (buf ," TABLESPACE = %s" ,
581581fmtId (dbtablespace ));
582582