
do not use a serial but a sequence - that way you have a unique value (just read up on sequences)
In MySQL you could use "select last_insert_id()" to get the insert id of table 1 and use that as the fk in table 2.
eek! what happens if users insert at the same time? On Wed, Jan 19, 2011 at 3:05 PM, James Nzomo <kazikubwa@gmail.com> wrote:
Locking may be a good option but the performance to integrity tradeoff ..... Locking might also frustrate users when trying to insert
Anyway, I think i'll use a different way of getting the primary key other than relying on the last insert Or maybe employ the use of a surrogate key
I'll research on the matter then share the best solution in my view
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Best Regards,