Ramil,
> 1. insert a row to table A
> 2. get the value of the serial field from the now in no.1
> 3. insert a row to table B (one of the fields uses the value from no.2)
>
> in -one transaction-?
BEGIN TRANSACTION
INSERT INTO table_a ( 2, 3, 4 )
VALUES ( x, y, z );
INSERT INTO table_b ( a_FK, 3, 4 )
VALUES ( CURRVAL('table_a_seq'), m, q );
COMMIT TRANSACTION
Easy, neh? Now go to the online docs and do some reading about Sequences.
--
Josh Berkus
Aglio Database Solutions
San Francisco