On May 3, 2011, at 2:47 PM, java4dev wrote:
> insert into a values (1,1);
> insert into b values (1,1);
> insert into b values (2,1);
>
> I get
>
> ERROR: insert or update on table "a" violates foreign key constraint "rfr_main_b"
> DETAIL: Key (fk_main_b_id)=(1) is not present in table "b".
>
> ********** Error **********
Try something like:
BEGIN;
set constraints all deferred;
INSERT statement;
INSERT statement;
COMMIT;
Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com