Re: rename a table name - Mailing list pgsql-novice

From Joel Burton
Subject Re: rename a table name
Date
Msg-id JGEPJNMCKODMDHGOBKDNCEOCCFAA.joel@joelburton.com
Whole thread Raw
In response to rename a table name  (Bai Yan <baiyan@ece.ogi.edu>)
List pgsql-novice
joel=# \h alter table
Command:     ALTER TABLE
Description: change the definition of a table
Syntax:
ALTER TABLE [ ONLY ] table [ * ]
    ADD [ COLUMN ] column type [ column_constraint [ ... ] ]
ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column SET STATISTICS integer
ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column SET STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN}
ALTER TABLE [ ONLY ] table [ * ]
    RENAME [ COLUMN ] column TO newcolumn
ALTER TABLE table
    RENAME TO new_table
ALTER TABLE table
    ADD table_constraint_definition
ALTER TABLE [ ONLY ] table
        DROP CONSTRAINT constraint { RESTRICT | CASCADE }
ALTER TABLE table
        OWNER TO new_owner


... unless you're using an old version of PG.

Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Bai Yan
> Sent: Tuesday, March 19, 2002 12:57 AM
> To: pgsql-novice@postgresql.org
> Subject: [NOVICE] rename a table name
>
>
> Hello all,
>
> I am new for postgresql and have a big bunch of problems.
>
> I create a table named 'action-test' but now I want to change the name to
> 'action', ALTER TALBE command doesn't help and I didn't find a command as
> 'rename'.
>
> How can I create a table copied from another table, say, both
> have the same
> structure and content?
>
> Thanks a lot,
>
> Yan Bai
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


pgsql-novice by date:

Previous
From: Jason Earl
Date:
Subject: Re: Fwd: Query results
Next
From: "Joel Burton"
Date:
Subject: Re: Fwd: Query results