Fw: Removing foreign key and adding sequence

From: "Chad Thompson" <chad(at)weblinkservices(dot)com>
To: "pgsql-novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Fw: Removing foreign key and adding sequence
Date: 2003-06-26 17:28:37
Message-ID: 001b01c33c08$62070ce0$32021aac@chad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> Chad,
>
> > alter table lists rename to lists_bak;
> >
> > select * from lists_bak into lists;
> >
> > I can add the constraints and foreign key's back in that ARE necessary,
my
> > only worry (and mabey you can think of another worry) is that my
sequence
> > is no longer attached to the id field of my table.
> >
> > Is this the right approach, and if so, how do I add my sequence back
in?
>
> Simple: when you re-create Lists, just make sure that the id is "DEFAULT
> NEXTVAL('sequence_name')". That's it. Sequences are easy.

The id is a foreign key on other tables, so I dont want to reorder the
table. You're saying that I wouldn't reorder if I did it this way?

>
> However, I think it might be easier just to drop the FKs. What version
are
> you using?
>

7.32. Can I just drop the foreign key? That would be SO much easier :-)

Thanks
Chad

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2003-06-26 18:17:39 Re: Fw: Removing foreign key and adding sequence
Previous Message Josh Berkus 2003-06-26 17:12:18 Re: Removing foreign key and adding sequence