Skip site navigation (1) Skip section navigation (2)

Re: Transaction-based insert w/PHP?

From: Dror Matalon <dror(at)zapatec(dot)com>
To: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: Transaction-based insert w/PHP?
Date: 2003-02-13 01:01:47
Message-ID: (view raw, whole thread or download thread mbox)
Lists: sfpug

As a rule I agree. The only exception is for tool writers. People like
us, who don't really know the structure of a table at run time, really
benefit from using OIDs. As long as you remember that they're not unique
across tables, you should be safe.


On Wed, Feb 12, 2003 at 04:52:45PM -0800, Josh Berkus wrote:
> David,
> > 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.
> -- 
> Josh Berkus
> Aglio Database Solutions
> San Francisco
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

Dror Matalon
Zapatec Inc
1700 MLK Way
Berkeley, CA 94709

In response to


sfpug by date

Next:From: Josh BerkusDate: 2003-02-13 01:03:55
Subject: Re: Transaction-based insert w/PHP?
Previous:From: Dror MatalonDate: 2003-02-13 00:59:41
Subject: Re: Transaction-based insert w/PHP?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group