Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf94cec6

Browse files
committed
Include partitioned indexes to system view pg_indexes
pg_tables already includes partitioned tables, so for consistencypg_indexes should show partitioned indexes.Author: Suraj KharageReviewed-by: Amit Langote, Michael PaquierDiscussion:https://postgr.es/m/CAF1DzPVrYo4XNTEnc=PqVp6aLJc7LFYpYR4rX=_5pV=wJ2KdZg@mail.gmail.com
1 parent3e514c1 commitf94cec6

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

‎src/backend/catalog/system_views.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ CREATE VIEW pg_indexes AS
162162
JOIN pg_class ION (I.oid=X.indexrelid)
163163
LEFT JOIN pg_namespace NON (N.oid=C.relnamespace)
164164
LEFT JOIN pg_tablespace TON (T.oid=I.reltablespace)
165-
WHEREC.relkindIN ('r','m')ANDI.relkind='i';
165+
WHEREC.relkindIN ('r','m','p')ANDI.relkindIN ('i','I');
166166

167167
CREATE OR REPLACEVIEWpg_sequencesAS
168168
SELECT

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201812141
56+
#defineCATALOG_VERSION_NO201812181
5757

5858
#endif

‎src/test/regress/expected/indexing.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ select relhassubclass from pg_class where relname = 'idxpart_idx';
1010
f
1111
(1 row)
1212

13+
-- Check that partitioned indexes are present in pg_indexes.
14+
select indexdef from pg_indexes where indexname like 'idxpart_idx%';
15+
indexdef
16+
-----------------------------------------------------------------
17+
CREATE INDEX idxpart_idx ON ONLY public.idxpart USING btree (a)
18+
(1 row)
19+
1320
drop index idxpart_idx;
1421
create table idxpart1 partition of idxpart for values from (0) to (10);
1522
create table idxpart2 partition of idxpart for values from (10) to (100)

‎src/test/regress/expected/rules.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ pg_indexes| SELECT n.nspname AS schemaname,
13581358
JOIN pg_class i ON ((i.oid = x.indexrelid)))
13591359
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
13601360
LEFT JOIN pg_tablespace t ON ((t.oid = i.reltablespace)))
1361-
WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'm'::"char"])) AND (i.relkind = 'i'::"char"));
1361+
WHERE ((c.relkind = ANY (ARRAY['r'::"char", 'm'::"char", 'p'::"char"])) AND (i.relkind =ANY (ARRAY['i'::"char", 'I'::"char"])));
13621362
pg_locks| SELECT l.locktype,
13631363
l.database,
13641364
l.relation,

‎src/test/regress/sql/indexing.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ create table idxpart (a int, b int, c text) partition by range (a);
66
-- It will be set after the first partition is created.
77
createindexidxpart_idxon idxpart (a);
88
select relhassubclassfrom pg_classwhere relname='idxpart_idx';
9+
10+
-- Check that partitioned indexes are present in pg_indexes.
11+
select indexdeffrom pg_indexeswhere indexnamelike'idxpart_idx%';
912
dropindex idxpart_idx;
1013

1114
createtableidxpart1 partition of idxpart forvaluesfrom (0) to (10);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp