Charlie Toohey <[EMAIL PROTECTED]> writes: > A better solution would seem to use a sequence explicitly, rather than a id > column of type serial. I would obtain the id value from the sequence, and > then insert this id into the master table and into the detail table.
Yup. But there's no need to change how you create the id column; serial is just fine, since all it is is a sequence and a DEFAULT nextval('foo'). You just do something like select nextval('name-of-id-columns-sequence') into $masterid; insert into master(id, ...) values ($masterid, ...); insert into detail ... $masterid ...; rather than letting the default expression do it for you. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]