<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>