Received: from relay.EECS.Berkeley.EDU (relay.EECS.Berkeley.EDU [169.229.34.228]) by hub.org (8.9.3/8.9.3) with ESMTP id BAA11705; Wed, 19 Apr 2000 01:51:27 -0400 (EDT) (envelope-from mdenny@CS.Berkeley.EDU) Received: from CS.Berkeley.EDU (caracas.CS.Berkeley.EDU [128.32.46.231]) by relay.EECS.Berkeley.EDU (8.9.3/8.9.3) with ESMTP id WAA04601; Tue, 18 Apr 2000 22:51:26 -0700 (PDT) Received: (from mdenny@localhost) by CS.Berkeley.EDU (8.9.3/8.9.3) id WAA15842; Tue, 18 Apr 2000 22:51:25 -0700 (PDT) From: Matthew Denny MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 18 Apr 2000 22:51:25 -0700 (PDT) To: pgsql-interfaces@postgresql.org, pgsql-novice@postgresql.org Subject: getting OID of INSERTed record in ECPG In-Reply-To: <14587.56388.364036.838765@caracas.CS.Berkeley.EDU> References: <14587.56388.364036.838765@caracas.CS.Berkeley.EDU> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14589.17214.758887.216706@caracas.CS.Berkeley.EDU> X-Archive-Number: 200004/137 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!