Re: The command tag of "ALTER MATERIALIZED VIEW RENAME COLUMN" - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: The command tag of "ALTER MATERIALIZED VIEW RENAME COLUMN"
Date
Msg-id CAHGQGwEYQ2BYOwC5myfzTFd2uTvut4ukNWuCmkuvNiWH6UNGcQ@mail.gmail.com
Whole thread Raw
In response to Re: The command tag of "ALTER MATERIALIZED VIEW RENAME COLUMN"  (Ibrar Ahmed <ibrar.ahmad@gmail.com>)
Responses Re: The command tag of "ALTER MATERIALIZED VIEW RENAME COLUMN"  (Ibrar Ahmed <ibrar.ahmad@gmail.com>)
List pgsql-hackers
On Fri, Nov 1, 2019 at 6:34 AM Ibrar Ahmed <ibrar.ahmad@gmail.com> wrote:
>
>
>
> On Thu, Oct 31, 2019 at 6:56 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>> Fujii Masao <masao.fujii@gmail.com> writes:
>> > ... I found that the command tag of
>> > ALTER MATERIALIZED VIEW RENAME COLUMN is "ALTER TABLE", not "ALTER VIEW".
>>
>> >     =# ALTER MATERIALIZED VIEW hoge RENAME COLUMN j TO x;
>> >     ALTER TABLE
>>
>> > Is this intentional? Or bug?
>>
>> Seems like an oversight.

Thanks for the check!

> The same issue is with ALTER FOREIGN TABLE

Yes.

> Attached patch fixes that for ALTER VIEW , ALTER MATERIALIZED VIEW and ALTER FOREIGN TABLE

You introduced subtype in your patch, but I think it's better and simpler
to just give relationType to AlterObjectTypeCommandTag()
if renaming the columns (i.e., renameType = OBJECT_COLUMN).

To avoid this kind of oversight about command tag, I'd like to add regression
tests to make sure that SQL returns valid and correct command tag.
But currently there seems no mechanism for such test, in regression
test. Right??
Maybe we will need that mechanism.

Regards,

-- 
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: abs function for interval
Next
From: Euler Taveira
Date:
Subject: Re: Restore replication settings when modifying a field type