Re: ALTER INDEX .. RENAME allows to rename tables/views as well - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: ALTER INDEX .. RENAME allows to rename tables/views as well
Date
Msg-id E17E5D34-2EEF-48A1-BEF1-DD97EA17403D@amazon.com
Whole thread Raw
In response to Re: ALTER INDEX .. RENAME allows to rename tables/views as well  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ALTER INDEX .. RENAME allows to rename tables/views as well  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 10/6/21, 3:44 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> "Bossart, Nathan" <bossartn@amazon.com> writes:
>> Here's a patch that ERRORs if the object type and statement type do
>> not match.  Interestingly, some of the regression tests were relying
>> on this behavior.
>
> ... as, no doubt, are a lot of applications that this will gratuitously
> break.  We've long had a policy that ALTER TABLE will work on relations
> that aren't tables, so long as the requested operation is sensible.

Right.

> The situation for "ALTER some-other-relation-kind" is a bit more
> confused, because some cases throw errors and some don't; but I really
> doubt that tightening things up here will earn you anything but
> brickbats.  I *definitely* don't agree with discarding the policy
> about ALTER TABLE, especially if it's only done for RENAME.

I think we should at least consider adding this check for ALTER INDEX
since we choose a different lock level in that case.

Nathan


pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: BUG #17212: pg_amcheck fails on checking temporary relations
Next
From: Andrew Dunstan
Date:
Subject: Re: plperl: update ppport.h and fix configure version check