Re: Adding Foreign Key Constraint To Existing Table

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: Adding Foreign Key Constraint To Existing Table
Дата
Msg-id 4E0E37E1.4070707@commandprompt.com
обсуждение исходный текст
Ответ на Adding Foreign Key Constraint To Existing Table  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Adding Foreign Key Constraint To Existing Table  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
On 07/01/2011 02:00 PM, Rich Shepard wrote:
> I've examined the 9.0 manual page on alter table without seeing how to add
> a foreign key constraint to a column.
>
> I needed to make changes on a couple of existing tables which could be
> accomplished only by dropping the foreign key constraint. That, and
> changing
> the table structure, column names, and column types were successful. But, I
> am not seeing the proper syntax to add a foreign key constraint back to the
> two affected tables.
>
> Pointer please.

alter table bar add foreign key (id) references foo(id);

JD

>
> Rich
>
>


--
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Support, Training, Professional Services and Development
The PostgreSQL Conference - http://www.postgresqlconference.org/
@cmdpromptinc - @postgresconf - 509-416-6579

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Adding Foreign Key Constraint To Existing Table
Следующее
От: Thom Brown
Дата:
Сообщение: Re: Adding Foreign Key Constraint To Existing Table