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

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

From: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: renameatt() can rename attribute of index, sequence, ...
Date: 2010-03-03 02:19:27
Message-ID: 4B8DC72F.3050600@ak.jp.nec.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Is it an expected behavior?

  postgres=> CREATE SEQUENCE s;
  CREATE SEQUENCE
  postgres=> ALTER TABLE s RENAME sequence_name TO abcd;
  ALTER TABLE

  postgres=> CREATE TABLE t (a int primary key, b text);
  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t_pkey" for table "t"
  CREATE TABLE
  postgres=> ALTER TABLE t_pkey RENAME a TO xyz;
  ALTER TABLE

The documentation says:
  http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html

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

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

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-03-03 02:22:50
Subject: Re: renameatt() can rename attribute of index, sequence, ...
Previous:From: Andrew DunstanDate: 2010-03-03 02:00:03
Subject: Re: plperl _init settings

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