From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@postgresql.org
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Subject: \d+ fails on index on partition
Date: Thu, 27 Sep 2018 15:00:20 -0500
Message-ID: <20180927200020.GJ776@telsasoft.com> (raw)
For indices inherited from relkind=p:
pryzbyj=# CREATE TABLE tt(i int)PARTITION BY RANGE(i);
pryzbyj=# CREATE TABLE tt1 PARTITION OF tt DEFAULT;
pryzbyj=# CREATE INDEX ON tt((0+i));
pryzbyj=# ALTER INDEX tt1_expr_idx ALTER COLUMN 1 SET STATISTICS 123;
pryzbyj=# \d+ tt1_expr_idx
ERROR: 42809: "tt1_expr_idx" is an index
LOCATION: heap_open, heapam.c:1305
Failing due to:
********* QUERY **********
SELECT inhparent::pg_catalog.regclass,
pg_catalog.pg_get_expr(c.relpartbound, inhrelid),
pg_catalog.pg_get_partition_constraintdef(inhrelid)
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_inherits i ON c.oid = inhrelid
WHERE c.oid = '40129092' AND c.relispartition;
**************************
pg_get_partition_constraintdef() doesn't like being passed a relkind='I',
"ATTACH"ed index, which I guess is included in pg_inherit (commit 8b08f7d48):
pryzbyj=# SELECT inhparent::regclass, inhrelid::regclass, * FROM pg_inherits WHERE inhrelid='tt1_expr_idx'::regclass;
inhparent | tt_expr_idx
inhrelid | tt1_expr_idx
inhrelid | 40129092
inhparent | 40129091
inhseqno | 1
I'll spare you the burden of any fix I might attempt to cobble together.
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, alvherre@2ndquadrant.com
Subject: Re: \d+ fails on index on partition
In-Reply-To: <20180927200020.GJ776@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox