Skip site navigation (1) Skip section navigation (2)

Re: renameatt() can rename attribute of index, sequence, ...

From: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: renameatt() can rename attribute of index, sequence, ...
Date: 2010-03-03 06:03:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
(2010/03/03 14:26), Robert Haas wrote:
> 2010/3/2 KaiGai Kohei<kaigai(at)ak(dot)jp(dot)nec(dot)com>:
>> Is it an expected behavior?
>>   postgres=>  CREATE SEQUENCE s;
>>   postgres=>  ALTER TABLE s RENAME sequence_name TO abcd;
>>   postgres=>  CREATE TABLE t (a int primary key, b text);
>>   NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t_pkey" for table "t"
>>   postgres=>  ALTER TABLE t_pkey RENAME a TO xyz;
>> The documentation says:
>>     :
>>     The RENAME forms change the name of a table (or an index, sequence, or view) or
>>     the name of an individual column in a table. There is no effect on the stored data.
>> It seems to me the renameatt() should check relkind of the specified relation, and
>> raise an error if relkind != RELKIND_RELATION.
> Are we talking about renameatt() or RenameRelation()?  Letting
> RenameRelation() rename whatever seems fairly harmless; renameatt(),
> on the other hand, should probably refuse to allow this:
> ALTER TABLE foo RENAME COLUMN is_cycled TO bob;
> ...because that's just weird.  Tables, indexes, and views make sense,
> but the attributes of a sequence should be nailed down I think;
> they're basically system properties.

I'm talking about renameatt(), not RenameRelation().

If our perspective is these are a type of system properties, we should
be able to reference these attributes with same name, so it is not harmless
to allow renaming these attributes.

I also agree that it makes sense to allow renaming attributes of tables
and views. But I don't know whether it makes sense to allow it on indexs,
like sequence and toast relations.

KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

In response to


pgsql-hackers by date

Next:From: Jaime CasanovaDate: 2010-03-03 06:07:11
Subject: Re: Re: [COMMITTERS] pgsql: Instead of trying (and failing) to allow <<label>> at the end of
Previous:From: Tom LaneDate: 2010-03-03 06:00:26
Subject: Re: Re: [COMMITTERS] pgsql: Instead of trying (and failing) to allow <<label>> at the end of

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group