getting OID of INSERTed record in ECPG

From: Matthew Denny <mdenny(at)CS(dot)Berkeley(dot)EDU>
To: pgsql-interfaces(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: getting OID of INSERTed record in ECPG
Date: 2000-04-19 05:51:25
Message-ID: 14589.17214.758887.216706@caracas.CS.Berkeley.EDU
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


After sending the message below yesterday, I decided to look at the
source to see where sqlca.sqlerrd[1] gets updated. From what I can
tell, nowhere in ecpglib.c (or any other file) is sqlca.sqlerrd[1]
even referenced much less updated. However, the documentation and a
post to psql-interfaces (appended to the bottom of this email) seems
to indicate that sqlca.sqlerrd[1] will hold the OID of an INSERTed
tuple if a single tuple is inserted. Do I have the most up-to-date
source and binaries? Here's what I have:

source:
postgresql-6.5.3.tar.gz (D/Led from postgresql.org)

binaries: (Linux RPMs D/Led from postgresql.org)
postgresql-6.5.3-3.rpm
postgresql-server-6.5.3-3.rpm
postgresql-6.5.3-3.rpm
postgresql-devel-6.5.3-3.rpm
postgresql-examples-1.0-1.rpm

If there is any patches that I am missing here, any help would be
greatly appreciated. Also, If anyone knows a workaround for getting
the OID of a tuple INSERTed into a table, I would appreciate this as
well.

thanks in advance,
Matt Denny

Matthew Denny writes:
>
> Does anyone know how to get the OID of an INSERTed tuple when using
> PostgreSQL and ECPG? The documentation and the mail archives state that the
> OID of an INSERTed tuple is placed in sqlca.sqlerrd[1] after the SQL
> call. Although I can get sqlca to return error messages and error
> codes reliably in the same program, sqlca.sqlerrd[1] always equals 0
> even after a successful insert. Has anyone had this same problem?
> I'm using the Linux binary distribution of PostgreSQL 6.5.3-3. Any
> possible solutions or workarounds would be greatly appreciated.
>
> thanks,
> Matt Denny
>
>

;; message from psql-interfaces mentioned above

On Wed, Sep 15, 1999 at 09:50:52AM +0200, Ansley, Michael wrote:
> I don't think that a sequence number should be going into sqlca.
This is
> what it sounds like you are going to do, yes?

But this wasn't what I meant. :-)

I wasn't wording very well. What I wanted to say was that I don't see
much
of a chance to give back the serial as such. What I added to my TODO
list
(and btw just committed the changed source) is the return of the OID
for the
singleton insert.

Michael

--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael(at)Fam-Meskes(dot)De | Use PostgreSQL!

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-04-19 06:45:15 RE: psql & java
Previous Message Tom Lane 2000-04-19 04:21:05 Re: lo_import problems