> Does fetching that OID inside a transaction automatically guarantee
> that the right thing happens?
Maybe, maybe not. Regardless, you're making an easy task hard. You'd be
better off staying away from OIDs entirely:
> INSERT INTO foo (foo_desc)
> VALUES ('too much unix!')
> -- Fetch the $foo_id, or roll back if unable.
$new_foo = currval('foo_foo_id_seq')
> INSERT INTO bar (bar_desc, foo_id)
> VALUES ('never too much unix!', $new_foo)
I'd suggest reading the docs on sequences. There is no reason for you ever to
use OIDs at all.
Aglio Database Solutions
In response to
sfpug by date
|Next:||From: Dror Matalon||Date: 2003-02-13 00:59:41|
|Subject: Re: Transaction-based insert w/PHP?|
|Previous:||From: David Fetter||Date: 2003-02-12 20:35:07|
|Subject: Transaction-based insert w/PHP?|