Re: [GENERAL] Replacing an existing unique constraint (not UNIQUE INDEX) with primary key
Вложения
В списке pgsql-general по дате отправления:
| От | Achilleas Mantzios |
|---|---|
| Тема | Re: [GENERAL] Replacing an existing unique constraint (not UNIQUE INDEX) with primary key |
| Дата | |
| Msg-id | 58590B30.9040303@matrix.gatewaynet.com обсуждение исходный текст |
| Ответ на | Re: [GENERAL] Replacing an existing unique constraint (not UNIQUE INDEX) with primary key (Andreas Joseph Krogh <andreas@visena.com>) |
| Ответы |
Re: [GENERAL] Replacing an existing unique constraint (not UNIQUE INDEX) with primary key
|
| Список | pgsql-general |
You may write a script to output those 34 FK constraints. Definitely safer than hacking pg_constraint.conindid .På tirsdag 20. desember 2016 kl. 11:02:27, skrev Achilleas Mantzios <achill@matrix.gatewaynet.com>:On 20/12/2016 11:43, Andreas Joseph Krogh wrote:BEGIN;[snip]
ALTER TABLE person ADD CONSTRAINT person_pk PRIMARY KEY (entity_id);
alter table person drop constraint person_entity_id_key CASCADE;
alter table phone add CONSTRAINT phone_fk FOREIGN KEY (person_entity_id) REFERENCES person(entity_id);
alter table address add CONSTRAINT address_fk FOREIGN KEY (person_id) REFERENCES person(entity_id);
COMMIT;Yea, I was hoping to avoid having to manually add the FK's to the referencing tables (34).Is there really no way to accomplish this without DROP CONSTRAINT ... CASCADE, hacking the system-catalogs or something?
Thanks.--Andreas Joseph KroghCTO / Partner - Visena ASMobile: +47 909 56 963
-- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера
