Re: rename a table name

From: "Joel Burton" <joel(at)joelburton(dot)com>
To: "Bai Yan" <baiyan(at)ece(dot)ogi(dot)edu>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: rename a table name
Date: 2002-03-19 18:07:57
Message-ID: JGEPJNMCKODMDHGOBKDNCEOCCFAA.joel@joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

> -----Original Message-----
> From: pgsql-novice-owner(at)postgresql(dot)org
> [mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Bai Yan
> Sent: Tuesday, March 19, 2002 12:57 AM
> To: pgsql-novice(at)postgresql(dot)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
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Joel Burton 2002-03-19 18:12:55 Re: Fwd: Query results
Previous Message Jason Earl 2002-03-19 17:02:17 Re: Fwd: Query results