Commit f94cec64 authored by Michael Paquier's avatar Michael Paquier

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
parent 3e514c12
......@@ -162,7 +162,7 @@ CREATE VIEW pg_indexes AS
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 = 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
SELECT
......
......@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201812141
#define CATALOG_VERSION_NO 201812181
#endif
......@@ -10,6 +10,13 @@ select relhassubclass from pg_class where relname = 'idxpart_idx';
f
(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;
create table idxpart1 partition of idxpart for values from (0) to (10);
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)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
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,
l.database,
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.
create index idxpart_idx on idxpart (a);
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;
create table idxpart1 partition of idxpart for values from (0) to (10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment