From: | Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com> |
---|---|
To: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Rename or Re-Create Constraints? |
Date: | 2011-04-09 00:09:03 |
Message-ID: | BANLkTik-yF=zx6aB1hFNo1EqujjnXxoEsw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-04-09 00:35:59 | Re: Rename or Re-Create Constraints? |
Previous Message | Jeff Davis | 2011-04-08 23:21:57 | Re: Deferred foreign key constraint downsides |