unexpected relkind: 73 ERROR with partition table index

Started by Rajkumar Raghuwanshiover 8 years ago4 messageshackers
Jump to latest
#1Rajkumar Raghuwanshi
rajkumar.raghuwanshi@enterprisedb.com

Hi,

I am getting "ERROR: unexpected relkind: 73" when trying to rename
partition table index with below test case.

create user u1 superuser;
create user u2 nosuperuser login;
\c postgres u1

create table public.part(c1 int, c2 int) partition by range(c1);
create table public.part_p1 partition of public.part for values from
(minvalue) to (0);
create table public.part_p2 partition of public.part for values from (0) to
(maxvalue);
create index part_idx on public.part(c1);

create table public.nopart (c1 int, c2 int);
create index nopart_idx on public.nopart(c1);

--switch to nonsuperuser
\c postgres u2

postgres=> --rename the index owned by another user --non partition table
postgres=> ALTER INDEX nopart_idx RENAME TO nopart_idx_renamed;
ERROR: must be owner of index nopart_idx
postgres=>
postgres=> --rename the index owned by another user --partition table
postgres=> ALTER INDEX part_idx RENAME TO part_idx_renamed;
ERROR: unexpected relkind: 73

Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation

#2David Rowley
david.rowley@2ndquadrant.com
In reply to: Rajkumar Raghuwanshi (#1)
Re: unexpected relkind: 73 ERROR with partition table index

On 27 June 2018 at 00:18, Rajkumar Raghuwanshi
<rajkumar.raghuwanshi@enterprisedb.com> wrote:

postgres=> ALTER INDEX part_idx RENAME TO part_idx_renamed;
ERROR: unexpected relkind: 73

Seems to be caused by the auth failure code path in
RangeVarCallbackForAlterRelation().

Patch attached.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

teach_get_relkind_objtype_about_partitioned_indexes.patchapplication/octet-stream; name=teach_get_relkind_objtype_about_partitioned_indexes.patchDownload+1-0
#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: David Rowley (#2)
Re: unexpected relkind: 73 ERROR with partition table index

On 2018-Jun-27, David Rowley wrote:

On 27 June 2018 at 00:18, Rajkumar Raghuwanshi
<rajkumar.raghuwanshi@enterprisedb.com> wrote:

postgres=> ALTER INDEX part_idx RENAME TO part_idx_renamed;
ERROR: unexpected relkind: 73

Seems to be caused by the auth failure code path in
RangeVarCallbackForAlterRelation().

Ah, yeah, thanks. No surprise this was missed, since I didn't add
tests for ALTER INDEX RENAME and Peter concurrently refactored the
handling code. I propose we add a few more test lines, as attached.

--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-fix-get_relkind_objtype-introduced-by-8b9e9644dc6a9b.patchtext/plain; charset=us-asciiDownload+48-3
#4Rajkumar Raghuwanshi
rajkumar.raghuwanshi@enterprisedb.com
In reply to: Alvaro Herrera (#3)
Re: unexpected relkind: 73 ERROR with partition table index

Thanks for fix and commit. It is working fine now.

Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation

On Tue, Jun 26, 2018 at 8:39 PM, Alvaro Herrera <alvherre@2ndquadrant.com>
wrote:

Show quoted text

On 2018-Jun-27, David Rowley wrote:

On 27 June 2018 at 00:18, Rajkumar Raghuwanshi
<rajkumar.raghuwanshi@enterprisedb.com> wrote:

postgres=> ALTER INDEX part_idx RENAME TO part_idx_renamed;
ERROR: unexpected relkind: 73

Seems to be caused by the auth failure code path in
RangeVarCallbackForAlterRelation().

Ah, yeah, thanks. No surprise this was missed, since I didn't add
tests for ALTER INDEX RENAME and Peter concurrently refactored the
handling code. I propose we add a few more test lines, as attached.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services