Thread

Commits

  1. Enable failure to rename a partitioned index

  1. unexpected relkind: 73 ERROR with partition table index

    Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com> — 2018-06-26T12:18:18Z

    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
    
  2. Re: unexpected relkind: 73 ERROR with partition table index

    David Rowley <david.rowley@2ndquadrant.com> — 2018-06-26T13:10:38Z

    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
    
  3. Re: unexpected relkind: 73 ERROR with partition table index

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2018-06-26T15:09:15Z

    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
    
  4. Re: unexpected relkind: 73 ERROR with partition table index

    Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com> — 2018-06-27T05:59:45Z

    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:
    
    > 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
    >