"Norman Khine" <norman(at)khine(dot)net> writes:
> 1) INSERT INTO business_name (business_name, business_url)
> values ('<dtml-var business_name>', '<dtml-var business_url>');
> 2) select last_value from business_name_business_name_seq
Instead use
select currval('business_name_business_name_seq');
to get the assigned sequence value without a race condition. See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/functions-sequence.html
Actually you don't need to bother with the separate select, unless
your client code needs that ID for other purposes. You could just
write the currval() call in the second INSERT.
regards, tom lane