Re: [HACKERS] Getting OID in psql of recent insert

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Getting OID in psql of recent insert
Date: 1999-11-21 00:55:03
Message-ID: 199911210055.TAA20248@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> On 1999-11-18, Tom Lane mentioned:
>
> > It'd certainly be easy enough for psql to save off the OID anytime it
> > gets an "INSERT nnn" command response. The missing link is to invent
> > a way for a psql script to access that value and insert it into
> > subsequent SQL commands.
>
> Okay, I guess I'm way ahead of everyone here. It is in fact only a matter
> of adding a few lines to save the oid in a variable, and all the
> infrastructure for doing this is already present. In fact, I was going to
> do this in the next few days.
>
> testdb=> \set singlestep on
> testdb=> \set sql_interpol '#'
> testdb=> \set foo 'pg_class'
> testdb=> select * from #foo#;
> ***(Single step mode: Verify query)**************
> QUERY: select * from pg_class
> ***(press return to proceed or enter x and return to
> cancel)********************
> x
> testdb=>

This is exactly what I was hoping you would say.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-11-21 00:58:16 Re: [HACKERS] New regression driver
Previous Message Tom Lane 1999-11-21 00:10:09 Re: [HACKERS] New regression driver