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

From Tom Lane
Subject Re: ALTER INDEX .. RENAME allows to rename tables/views as well
Date
Msg-id 6471.1633560205@sss.pgh.pa.us
Whole thread Raw
In response to Re: ALTER INDEX .. RENAME allows to rename tables/views as well  ("Bossart, Nathan" <bossartn@amazon.com>)
Responses Re: ALTER INDEX .. RENAME allows to rename tables/views as well  ("Bossart, Nathan" <bossartn@amazon.com>)
Re: ALTER INDEX .. RENAME allows to rename tables/views as well  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
"Bossart, Nathan" <bossartn@amazon.com> writes:
> On 10/6/21, 1:52 PM, "Bruce Momjian" <bruce@momjian.us> wrote:
>> I can confirm this bug in git head, and I think it should be fixed.

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

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.

In short: no, I do not agree that this is a bug to be fixed.  Perhaps
we should have done things differently years ago, but it's too late to
redefine it.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "Bossart, Nathan"
Date:
Subject: Re: ALTER INDEX .. RENAME allows to rename tables/views as well
Next
From: Mark Dilger
Date:
Subject: Re: BUG #17212: pg_amcheck fails on checking temporary relations