Include partitioned indexes to system view pg_indexes
pg_tables already includes partitioned tables, so for consistency pg_indexes should show partitioned indexes. Author: Suraj Kharage Reviewed-by: Amit Langote, Michael Paquier Discussion: https://postgr.es/m/CAF1DzPVrYo4XNTEnc=PqVp6aLJc7LFYpYR4rX=_5pV=wJ2KdZg@mail.gmail.com
This commit is contained in:
parent
3e514c1238
commit
f94cec6447
@ -162,7 +162,7 @@ CREATE VIEW pg_indexes AS
|
|||||||
JOIN pg_class I ON (I.oid = X.indexrelid)
|
JOIN pg_class I ON (I.oid = X.indexrelid)
|
||||||
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
|
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
|
||||||
LEFT JOIN pg_tablespace T ON (T.oid = I.reltablespace)
|
LEFT JOIN pg_tablespace T ON (T.oid = I.reltablespace)
|
||||||
WHERE C.relkind IN ('r', 'm') AND I.relkind = 'i';
|
WHERE C.relkind IN ('r', 'm', 'p') AND I.relkind IN ('i', 'I');
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW pg_sequences AS
|
CREATE OR REPLACE VIEW pg_sequences AS
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -53,6 +53,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 201812141
|
#define CATALOG_VERSION_NO 201812181
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,6 +10,13 @@ select relhassubclass from pg_class where relname = 'idxpart_idx';
|
|||||||
f
|
f
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- Check that partitioned indexes are present in pg_indexes.
|
||||||
|
select indexdef from pg_indexes where indexname like 'idxpart_idx%';
|
||||||
|
indexdef
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
CREATE INDEX idxpart_idx ON ONLY public.idxpart USING btree (a)
|
||||||
|
(1 row)
|
||||||
|
|
||||||
drop index idxpart_idx;
|
drop index idxpart_idx;
|
||||||
create table idxpart1 partition of idxpart for values from (0) to (10);
|
create table idxpart1 partition of idxpart for values from (0) to (10);
|
||||||
create table idxpart2 partition of idxpart for values from (10) to (100)
|
create table idxpart2 partition of idxpart for values from (10) to (100)
|
||||||
|
@ -1358,7 +1358,7 @@ pg_indexes| SELECT n.nspname AS schemaname,
|
|||||||
JOIN pg_class i ON ((i.oid = x.indexrelid)))
|
JOIN pg_class i ON ((i.oid = x.indexrelid)))
|
||||||
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
|
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
|
||||||
LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace)))
|
LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace)))
|
||||||
WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'm'::"char"])) AND (i.relkind = 'i'::"char"));
|
WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'm'::"char", 'p'::"char"])) AND (i.relkind = ANY (ARRAY['i'::"char", 'I'::"char"])));
|
||||||
pg_locks| SELECT l.locktype,
|
pg_locks| SELECT l.locktype,
|
||||||
l.database,
|
l.database,
|
||||||
l.relation,
|
l.relation,
|
||||||
|
@ -6,6 +6,9 @@ create table idxpart (a int, b int, c text) partition by range (a);
|
|||||||
-- It will be set after the first partition is created.
|
-- It will be set after the first partition is created.
|
||||||
create index idxpart_idx on idxpart (a);
|
create index idxpart_idx on idxpart (a);
|
||||||
select relhassubclass from pg_class where relname = 'idxpart_idx';
|
select relhassubclass from pg_class where relname = 'idxpart_idx';
|
||||||
|
|
||||||
|
-- Check that partitioned indexes are present in pg_indexes.
|
||||||
|
select indexdef from pg_indexes where indexname like 'idxpart_idx%';
|
||||||
drop index idxpart_idx;
|
drop index idxpart_idx;
|
||||||
|
|
||||||
create table idxpart1 partition of idxpart for values from (0) to (10);
|
create table idxpart1 partition of idxpart for values from (0) to (10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user