I've searched and really can't find a definitive example or someone
renaming a constraint. I renamed a table yesterday and noticed that
the constraint name was still named the old table name:
inkpress=# ALTER TABLE accounts RENAME TO fashion;
ALTER TABLE
inkpress=# \d fashion
Table "public.fashion"
Column | Type | Modifiers
---------+-----------------------+-----------
id | integer | not null
vendor | character varying(40) | not null
account | integer | not null
email | character varying(40) | not null
state | character(2) | not null
Indexes:
"accounts_pkey" PRIMARY KEY, btree (id)
"accounts_account_key" UNIQUE, btree (account)
"accounts_email_key" UNIQUE, btree (email)
"accounts_vendor_key" UNIQUE, btree (vendor)
1. Do I need to remove all the table constraints or is there a way to
rename them?
2. When renaming the table, is there a way to rename both the table
and all associated constraints?
I've looked over the following guide and am more confused than ever:
http://www.postgresql.org/docs/8.1/static/sql-altertable.html