Re: Rename or Re-Create Constraints?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To:
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rename or Re-Create Constraints?
Date: 2011-04-09 02:38:52
Message-ID: 4D9FC6BC.6090109@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Carlos Mennens wrote:
> 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.)
>>
>
> I'm sorry but I don't understand what that means or how to relate that
> to a SQL command to rename the constraint. Do you have an example of
> how that command would look?
>
>
>>> 2. When renaming the table, is there a way to rename both the table
>>> and all associated constraints?
>>>
>> No, there's nothing automatic for that. IIRC there used to be code to
>> try to do this when you renamed a single column; but we took it out,
>> probably because it risked unexpected failures due to index name
>> collisions.
>>
>> regards, tom lane
>>
>>

I wonder if OP wouldn't be best advised to externalize his DDL where by
simple editing would take care of the issue?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yang Zhang 2011-04-09 05:36:34 .pgpass not working?
Previous Message Carlos Mennens 2011-04-09 02:33:49 Re: Rename or Re-Create Constraints?