| От | Josh Berkus |
|---|---|
| Тема | Re: Removing foreign key and adding sequence |
| Дата | |
| Msg-id | 200306261012.18546.josh@agliodbs.com обсуждение исходный текст |
| Ответ на | Removing foreign key and adding sequence ("Chad Thompson" <chad@weblinkservices.com>) |
| Ответы |
basic question
|
| Список | 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.
However, I think it might be easier just to drop the FKs. What version are
you using?
--
Josh Berkus
Aglio Database Solutions
San Francisco
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера