pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedGetting last used oid
5+ messages / 4 participants
[nested] [flat]
* Getting last used oid
@ 1999-12-07 16:31 John C Cusick <jcc2@juno.com>
1999-12-07 16:53 ` Re: [SQL] Getting last used oid Peter Eisentraut <e99re41@DoCS.UU.SE>
1999-12-08 00:19 ` Re: [SQL] Getting last used oid Bruce Momjian <pgman@candle.pha.pa.us>
1999-12-08 08:36 ` Re: [SQL] Getting last used oid Vladimir Terziev <vlady@school.digsys.bg>
0 siblings, 3 replies; 5+ messages in thread
From: John C Cusick @ 1999-12-07 16:31 UTC (permalink / raw)
To: pgsql-sql
To All,
How can I call up the last oid used in an insert statement? I've checked
the docs (but not the source - getting a little big :-) by way of the
TOC's and didn't see it. I'm assuming/hoping there is a function
similar to lastval, curval, nextval for sequences available to
do this that I would like to use in a trigger to populate another table.
I also did a perusal of the new book, which looks *_really_* good so far,
but it didn't have what I was hoping to find.
I can do it normally of course (select oid, 'last_inserted_unique_field')
from table;) but
i would like a more behind the scenes way.
Thank you all,
John C.
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Getting last used oid
1999-12-07 16:31 Getting last used oid John C Cusick <jcc2@juno.com>
@ 1999-12-07 16:53 ` Peter Eisentraut <e99re41@DoCS.UU.SE>
2 siblings, 0 replies; 5+ messages in thread
From: Peter Eisentraut @ 1999-12-07 16:53 UTC (permalink / raw)
To: John C Cusick <jcc2@juno.com>; +Cc: pgsql-sql
On Tue, 7 Dec 1999, John C Cusick wrote:
> How can I call up the last oid used in an insert statement? I've checked
If you are writing in C, you can use the PQoidStatus() function. Similar
functions are provided in other language wrappers as well (e.g., Perl). A
way to do this in psql is going to be in the next release.
--
Peter Eisentraut Sernanders vaeg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Getting last used oid
1999-12-07 16:31 Getting last used oid John C Cusick <jcc2@juno.com>
@ 1999-12-08 00:19 ` Bruce Momjian <pgman@candle.pha.pa.us>
2 siblings, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 1999-12-08 00:19 UTC (permalink / raw)
To: John C Cusick <jcc2@juno.com>; +Cc: pgsql-sql
> To All,
>
> How can I call up the last oid used in an insert statement? I've checked
> the docs (but not the source - getting a little big :-) by way of the
> TOC's and didn't see it. I'm assuming/hoping there is a function
> similar to lastval, curval, nextval for sequences available to
> do this that I would like to use in a trigger to populate another table.
>
> I also did a perusal of the new book, which looks *_really_* good so far,
> but it didn't have what I was hoping to find.
>
> I can do it normally of course (select oid, 'last_inserted_unique_field')
> from table;) but
> i would like a more behind the scenes way.
6.6 or 7.0 will have a :LastOid variable in psql. From libpq in C,
there are functions to access it.
--
Bruce Momjian | http://www.op.net/~candle
maillist@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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Getting last used oid
1999-12-07 16:31 Getting last used oid John C Cusick <jcc2@juno.com>
@ 1999-12-08 08:36 ` Vladimir Terziev <vlady@school.digsys.bg>
2 siblings, 0 replies; 5+ messages in thread
From: Vladimir Terziev @ 1999-12-08 08:36 UTC (permalink / raw)
To: John C Cusick <jcc2@juno.com>; +Cc: pgsql-sql
Hi John,
There is diffrent ways to get last used oid.
Perl DBD::Pg has $oid = $stmt->{pg_oid_status}, where $stmt is a last
statement related with a insert command.
Vladimir
On Tue, 7 Dec 1999, John C Cusick wrote:
> To All,
>
> How can I call up the last oid used in an insert statement? I've checked
> the docs (but not the source - getting a little big :-) by way of the
> TOC's and didn't see it. I'm assuming/hoping there is a function
> similar to lastval, curval, nextval for sequences available to
> do this that I would like to use in a trigger to populate another table.
>
> I also did a perusal of the new book, which looks *_really_* good so far,
> but it didn't have what I was hoping to find.
>
> I can do it normally of course (select oid, 'last_inserted_unique_field')
> from table;) but
> i would like a more behind the scenes way.
>
> Thank you all,
>
> John C.
>
> ___________________________________________________________________
> Why pay more to get Web access?
> Try Juno for FREE -- then it's just $9.95/month if you act NOW!
> Get your free software today: http://dl.www.juno.com/dynoget/tagj.
>
> ************
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Getting last used oid
@ 1999-12-08 17:16 John C Cusick <jcc2@juno.com>
0 siblings, 0 replies; 5+ messages in thread
From: John C Cusick @ 1999-12-08 17:16 UTC (permalink / raw)
To: vlady@school.digsys.bg; +Cc: pgsql-sql
Vladimir and all,
the DBD::PG function is exactly why I asked. It's also available
in PHP/FI 3.xx
Because of these functions is why I asked. I can use PHP.
no problem.
Thanks for all your answers. Quick, as usual.
I'm looking forward to 7.0 and the new book. They both
look great so far.
On Wed, 8 Dec 1999 10:36:51 +0200 (EET) Vladimir Terziev
<vlady@school.digsys.bg> writes:
>
> Hi John,
>
> There is diffrent ways to get last used oid.
>
> Perl DBD::Pg has $oid = $stmt->{pg_oid_status}, where $stmt is a
>last
>statement related with a insert command.
>
>
> Vladimir
>
>
>On Tue, 7 Dec 1999, John C Cusick wrote:
>
>> To All,
>>
>> How can I call up the last oid used in an insert statement?
John C.
___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~1999-12-08 17:16 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-12-07 16:31 Getting last used oid John C Cusick <jcc2@juno.com>
1999-12-07 16:53 ` Peter Eisentraut <e99re41@DoCS.UU.SE>
1999-12-08 00:19 ` Bruce Momjian <pgman@candle.pha.pa.us>
1999-12-08 08:36 ` Vladimir Terziev <vlady@school.digsys.bg>
1999-12-08 17:16 Re: [SQL] Getting last used oid John C Cusick <jcc2@juno.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox