1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Fix pg_indexes view so that it shows the index's tablespace not the

parent table's tablespace, as per gripe from Michael Kleiser.  Choose
a more plausible column order for this view and pg_tables.  Update
documentation of these views, which was missed in original patch.
This commit is contained in:
Tom Lane
2004-10-11 17:24:41 +00:00
parent 5340a988c8
commit e5d30091e6
4 changed files with 22 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
*
* Copyright 1996-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.9 2004/07/21 20:43:45 momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.10 2004/10/11 17:24:40 tgl Exp $
*/
CREATE VIEW pg_user AS
@@ -41,8 +41,8 @@ CREATE VIEW pg_tables AS
SELECT
N.nspname AS schemaname,
C.relname AS tablename,
T.spcname AS tablespace,
pg_get_userbyid(C.relowner) AS tableowner,
T.spcname AS tablespace,
C.relhasindex AS hasindexes,
C.relhasrules AS hasrules,
(C.reltriggers > 0) AS hastriggers
@@ -54,13 +54,13 @@ CREATE VIEW pg_indexes AS
SELECT
N.nspname AS schemaname,
C.relname AS tablename,
T.spcname AS tablespace,
I.relname AS indexname,
T.spcname AS tablespace,
pg_get_indexdef(I.oid) AS indexdef
FROM pg_index X JOIN pg_class C ON (C.oid = X.indrelid)
JOIN pg_class I ON (I.oid = X.indexrelid)
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
LEFT JOIN pg_tablespace T ON (T.oid = C.reltablespace)
LEFT JOIN pg_tablespace T ON (T.oid = I.reltablespace)
WHERE C.relkind = 'r' AND I.relkind = 'i';
CREATE VIEW pg_stats AS
@@ -259,7 +259,7 @@ CREATE VIEW pg_stat_database AS
CREATE VIEW pg_locks AS
SELECT *
FROM pg_lock_status() AS L(relation oid, database oid,
transaction xid, pid int4, mode text, granted boolean);
transaction xid, pid int4, mode text, granted boolean);
CREATE VIEW pg_settings AS
SELECT *