Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-09 Thread Carlos Mennens
On Fri, Apr 8, 2011 at 8:35 PM, Tom Lane t...@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 |

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-09 Thread Tom Lane
Carlos Mennens carlos.menn...@gmail.com writes: On Fri, Apr 8, 2011 at 8:35 PM, Tom Lane t...@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.) I renamed the table name from

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-09 Thread Carlos Mennens
On Sat, Apr 9, 2011 at 12:58 PM, Tom Lane t...@sss.pgh.pa.us wrote: ALTER INDEX accounts_pkey RENAME TO whatever On very old versions of PG you may have to spell that ALTER TABLE instead of ALTER INDEX, but it's the same thing either way. Thank you so much for clearing that up for me Tom! I

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-09 Thread Adrian Klaver
On Saturday, April 09, 2011 2:59:06 pm Carlos Mennens wrote: On Sat, Apr 9, 2011 at 12:58 PM, Tom Lane t...@sss.pgh.pa.us wrote: ALTER INDEX accounts_pkey RENAME TO whatever On very old versions of PG you may have to spell that ALTER TABLE instead of ALTER INDEX, but it's the same thing

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-09 Thread Adrian Klaver
On Saturday, April 09, 2011 2:59:06 pm Carlos Mennens wrote: Is there a difference between an INDEX and a CONSTRAINT? Oops forgot to add this to my previous reply. The short version, an INDEX is one form of a CONSTRAINT. For the long version look at the CREATE TABLE section of the docs. It

[GENERAL] Rename or Re-Create Constraints?

2011-04-08 Thread Carlos Mennens
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

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-08 Thread Tom Lane
Carlos Mennens carlos.menn...@gmail.com writes: 1. Do I need to remove all the table constraints or is there a way to rename them? I believe you can rename the underlying indexes and the constraints will follow them. (This works in HEAD anyway, not sure how far back.) 2. When renaming the

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-08 Thread Carlos Mennens
On Fri, Apr 8, 2011 at 8:35 PM, Tom Lane t...@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.) I'm sorry but I don't understand what that means or how to relate that to a SQL command

Re: [GENERAL] Rename or Re-Create Constraints?

2011-04-08 Thread Rob Sargent
Carlos Mennens wrote: On Fri, Apr 8, 2011 at 8:35 PM, Tom Lane t...@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.) I'm sorry but I don't understand what that means or how