Re: Rename or Re-Create Constraints? - Mailing list pgsql-general

From Carlos Mennens
Subject Re: Rename or Re-Create Constraints?
Date
Msg-id BANLkTi=V3jaCiCQO7tdtE7H=V2sWhNcSwQ@mail.gmail.com
Whole thread Raw
In response to Re: Rename or Re-Create Constraints?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Rename or Re-Create Constraints?
List pgsql-general
On Fri, Apr 8, 2011 at 8:35 PM, Tom Lane <tgl@sss.pgh.pa.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.

:(

pgsql-general by date:

Previous
From: Clemens Eisserer
Date:
Subject: Re: Howto sort the result of UNION (without modifying its type)?
Next
From: Tom Lane
Date:
Subject: Re: Rename or Re-Create Constraints?