Re: Rename or Re-Create Constraints?

From: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rename or Re-Create Constraints?
Date: 2011-04-09 16:22:37
Message-ID: BANLkTi=V3jaCiCQO7tdtE7H=V2sWhNcSwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 8, 2011 at 8:35 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I believe you can rename the underlying indexes and the constraints will
> follow them.  (This works in HEAD anyway, not sure how far back.)

Below is my table:

inkpress=# \d marketing
Table "public.marketing"
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)

I renamed the table name from 'accounts' to 'marketing' however all
the constraints listed under 'indexes' are still named 'accounts_*'
and I've tried to rename them but I can't find any information with an
example command to rename the constraints:

ALTER TABLE marketing ...???

I can't find any update / alter SQL commands to correct the constraint
inconsistency.

:(

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-04-09 16:58:49 Re: Rename or Re-Create Constraints?
Previous Message Clemens Eisserer 2011-04-09 09:58:03 Re: Howto sort the result of UNION (without modifying its type)?