Re: OID wraparound (was Re: pg_depend) - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: OID wraparound (was Re: pg_depend)
Date
Msg-id 02a101c10fdd$c1f4cec0$2205010a@jester
Whole thread Raw
In response to Re: OID wraparound (was Re: pg_depend)  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
currval() could work nicely, but thats an additional query.  Currently
OID (in php among others) can be retrieved along with the insert
response which is instantly retrievable.  This makes for a very quick
middleware enforced foreign key entry in other databases.

Returning the entire primary key of the last row inserted without
doing additional queries -- this is a known element which could be
cached -- could be very useful in these situations.

With tables requiring multi-key elements we do a second select asking
for currval()s of the sequences.

--
Rod Taylor

Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.

----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Rod Taylor" <rbt@barchord.com>
Cc: "Lamar Owen" <lamar.owen@wgcr.org>; "Tom Lane"
<tgl@sss.pgh.pa.us>; "PostgreSQL-development"
<pgsql-hackers@postgresql.org>
Sent: Wednesday, July 18, 2001 5:06 PM
Subject: Re: OID wraparound (was Re: [HACKERS] pg_depend)


> > If OIDs are dropped a mechanism for retrieving the primary key of
the
> > last insert would be greatly appreciated.  Heck, it would be
useful
> > now (rather than returning OID).
> >
> > I much prefer retrieving the sequence number after the insert than
> > before insert where the insert uses it.  Especially when trigger
> > muckary is involved.
>
> Doesn't currval() work for your needs.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
19026
>



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: OID wraparound (was Re: pg_depend)
Next
From: "Ross J. Reedstrom"
Date:
Subject: Re: OID wraparound (was Re: pg_depend)