Re: The command tag of "ALTER MATERIALIZED VIEW RENAME COLUMN"

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: The command tag of "ALTER MATERIALIZED VIEW RENAME COLUMN"
Date: 2019-11-01 03:00:31
Message-ID: CAHGQGwEYQ2BYOwC5myfzTFd2uTvut4ukNWuCmkuvNiWH6UNGcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 1, 2019 at 6:34 AM Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com> wrote:
>
>
>
> On Thu, Oct 31, 2019 at 6:56 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> Fujii Masao <masao(dot)fujii(at)gmail(dot)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 Content-Type Size
cmdtag_of_alter_mv_v1.patch application/octet-stream 822 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2019-11-01 03:39:03 Re: Restore replication settings when modifying a field type
Previous Message Andres Freund 2019-11-01 02:45:24 Re: abs function for interval