Re: Postgres CTE issues
От | Marc Mamin |
---|---|
Тема | Re: Postgres CTE issues |
Дата | |
Msg-id | B6F6FD62F2624C4C9916AC0175D56D8828BCA89E@jenmbs01.ad.intershop.net обсуждение исходный текст |
Ответ на | Postgres CTE issues (Shekar Tippur <ctippur@gmail.com>) |
Ответы |
Re: Postgres CTE issues
|
Список | pgsql-sql |
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><br /> > This is what I amtrying:<br /> ><br /> > WITH x AS <br /> ><br /> > (INSERT INTO industry (name,abbr,description,cr_date,last_upd)<br /> ><br /> > VALUES ('df','','',now(),now()) returning id) insertinto sector (name,description,cr_date,last_upd,industry_id) select 's1','',now(),now(),id from x;<br /> ><br />> I get a error:<br /> ><br /> > ERROR: insert or update on table "sector" violates foreignkey constraint "sector_id_fkey"<br /> ><br /> > DETAIL: Key (id)=(394) is not present in table "industry".<br/> ><br /> > If I execute the insert individually, I am able to insert a record. Wonder whatI am doing wrong.<br /><br /> Hello,<br /> Defining your FK as deferrable initially deferred should help here.<br />regards,<br /><br /> Marc Mamin</div>
В списке pgsql-sql по дате отправления: