diff options
| author | Tom Lane | 2010-02-07 20:48:13 +0000 |
|---|---|---|
| committer | Tom Lane | 2010-02-07 20:48:13 +0000 |
| commit | b9b8831ad60f6e4bd580fe6dbe9749359298a3c4 (patch) | |
| tree | af6948498f13a43edd982b05808ed89b5b8191ab /contrib/oid2name | |
| parent | 7fc30c488fc6e9674564206193c29b1a657a818f (diff) | |
Create a "relation mapping" infrastructure to support changing the relfilenodes
of shared or nailed system catalogs. This has two key benefits:
* The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs.
* We no longer have to use an unsafe reindex-in-place approach for reindexing
shared catalogs.
CLUSTER on nailed catalogs now works too, although I left it disabled on
shared catalogs because the resulting pg_index.indisclustered update would
only be visible in one database.
Since reindexing shared system catalogs is now fully transactional and
crash-safe, the former special cases in REINDEX behavior have been removed;
shared catalogs are treated the same as non-shared.
This commit does not do anything about the recently-discussed problem of
deadlocks between VACUUM FULL/CLUSTER on a system catalog and other
concurrent queries; will address that in a separate patch. As a stopgap,
parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid
such failures during the regression tests.
Diffstat (limited to 'contrib/oid2name')
| -rw-r--r-- | contrib/oid2name/oid2name.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c index 9d896b84f5..52d6fafeaf 100644 --- a/contrib/oid2name/oid2name.c +++ b/contrib/oid2name/oid2name.c @@ -5,7 +5,7 @@ * Originally by * B. Palmer, bpalmer@crimelabs.net 1-17-2001 * - * $PostgreSQL: pgsql/contrib/oid2name/oid2name.c,v 1.36 2009/06/11 14:48:51 momjian Exp $ + * $PostgreSQL: pgsql/contrib/oid2name/oid2name.c,v 1.37 2010/02/07 20:48:08 tgl Exp $ */ #include "postgres_fe.h" @@ -440,7 +440,7 @@ sql_exec_dumpalldbs(PGconn *conn, struct options * opts) /* get the oid and database name from the system pg_database table */ snprintf(todo, sizeof(todo), "SELECT d.oid AS \"Oid\", datname AS \"Database Name\", " - "spcname AS \"Tablespace\" FROM pg_database d JOIN pg_tablespace t ON " + "spcname AS \"Tablespace\" FROM pg_catalog.pg_database d JOIN pg_catalog.pg_tablespace t ON " "(dattablespace = t.oid) ORDER BY 2"); sql_exec(conn, todo, opts->quiet); @@ -456,10 +456,10 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts) char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" "; snprintf(todo, sizeof(todo), - "SELECT relfilenode as \"Filenode\", relname as \"Table Name\" %s " + "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s " "FROM pg_class c " " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace " - " LEFT JOIN pg_catalog.pg_database d ON d.datname = current_database()," + " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database()," " pg_catalog.pg_tablespace t " "WHERE relkind IN ('r'%s%s) AND " " %s" @@ -477,7 +477,7 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts) } /* - * Show oid, relfilenode, name, schema and tablespace for each of the + * Show oid, filenode, name, schema and tablespace for each of the * given objects in the current database. */ void @@ -492,7 +492,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) bool written = false; char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" "; - /* get tables qualifiers, whether names, relfilenodes, or OIDs */ + /* get tables qualifiers, whether names, filenodes, or OIDs */ comma_oids = get_comma_elts(opts->oids); comma_tables = get_comma_elts(opts->tables); comma_filenodes = get_comma_elts(opts->filenodes); @@ -511,7 +511,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) { if (written) ptr += sprintf(ptr, " OR "); - ptr += sprintf(ptr, "c.relfilenode IN (%s)", comma_filenodes); + ptr += sprintf(ptr, "pg_catalog.pg_relation_filenode(c.oid) IN (%s)", comma_filenodes); written = true; } if (opts->tables->num > 0) @@ -527,10 +527,10 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) /* now build the query */ todo = (char *) myalloc(650 + strlen(qualifiers)); snprintf(todo, 650 + strlen(qualifiers), - "SELECT relfilenode as \"Filenode\", relname as \"Table Name\" %s\n" - "FROM pg_class c \n" + "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n" + "FROM pg_catalog.pg_class c \n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace \n" - " LEFT JOIN pg_catalog.pg_database d ON d.datname = current_database(),\n" + " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n" " pg_catalog.pg_tablespace t \n" "WHERE relkind IN ('r', 'i', 'S', 't') AND \n" " t.oid = CASE\n" @@ -554,7 +554,7 @@ sql_exec_dumpalltbspc(PGconn *conn, struct options * opts) snprintf(todo, sizeof(todo), "SELECT oid AS \"Oid\", spcname as \"Tablespace Name\"\n" - "FROM pg_tablespace"); + "FROM pg_catalog.pg_tablespace"); sql_exec(conn, todo, opts->quiet); } |
