rename

RENAME(SQL)                        Postgres95                        RENAME(SQL)



NAME
       rename — rename a class or an attribute in a class

SYNOPSIS
       alter table classname1
               rename to classname2
       alter table classname1 [*]
               rename [column] attname1 to attname2

DESCRIPTION
       The rename command causes the name of a class or attribute to change
       without changing any of the data contained in the affected class.  Thus,
       the class or attribute will remain of the same type and size after this
       command is executed.

       In order to rename an attribute in each class in an entire inheritance
       hierarchy, use the classname of the superclass and append a “*”.  (By
       default, the attribute will not be renamed in any of the subclasses.)
       This should always be done when changing an attribute name in a
       superclass.  If it is not, queries on the inheritance hierarchy such as
       select * from super* s
       will not work because the subclasses will be (in effect) missing an
       attribute found in the superclass.

       You must own the class being modified in order to rename it or part of
       its schema.  Renaming any part of the schema of a system catalog is not
       permitted.

EXAMPLE
       --
       -- change the emp class to personnel
       --
       alter table emp rename to personnel
       --
       -- change the sports attribute to hobbies
       --
       alter table emp rename column sports to hobbies
       --
       -- make a change to an inherited attribute
       --
       alter table person * rename column last_name to family_name

BUGS
       Execution of historical queries using classes and attributes whose names
       have changed will produce incorrect results in many situations.

       Renaming of types, operators, rules, etc., should also be supported.



Postgres95                          02/08/94                         RENAME(SQL)