From: Matthew Denny <mdenny@CS.Berkeley.EDU>
To: pgsql-interfaces@postgresql.org
To: pgsql-novice@postgresql.org
Subject: getting OID of INSERTed record in ECPG
Date: Tue, 18 Apr 2000 22:51:25 -0700 (PDT)
Message-ID: <14589.17214.758887.216706@caracas.CS.Berkeley.EDU> (raw)
In-Reply-To: <14587.56388.364036.838765@caracas.CS.Berkeley.EDU>
References: <14587.56388.364036.838765@caracas.CS.Berkeley.EDU>
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@Fam-Meskes.De | Use PostgreSQL!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: mdenny@CS.Berkeley.EDU, pgsql-novice@postgresql.org
Subject: Re: getting OID of INSERTed record in ECPG
In-Reply-To: <14589.17214.758887.216706@caracas.CS.Berkeley.EDU>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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