RE: [INTERFACES] ecpg and getting just assigned serial number - Mailing list pgsql-interfaces

From Ansley, Michael
Subject RE: [INTERFACES] ecpg and getting just assigned serial number
Date
Msg-id 1BF7C7482189D211B03F00805F8527F748C084@S-NATH-EXCH2
Whole thread Raw
Responses Re: [INTERFACES] ecpg and getting just assigned serial number  (Michael Meskes <meskes@postgresql.org>)
List pgsql-interfaces
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?

If anything is going to be returned in sqlca, it should only be the oid, at
least until Postgres gets a serial type (and probably after that as well),
and each table is guaranteed to only have one serial.  In effect, that's
what the oid is, so if the insert returns the oid in sqlca, then you can
select based on the oid.  Problem solved.  And this is only for a single
insert (i.e. an insert with the VALUES keyword).  For multiple inserts
(INSERT INTO <table> SELECT ...) this must be undefined, unless there is a
way of getting and returning all the oids, but I doubt it.

MikeA

>> -----Original Message-----
>> From: Michael Meskes [mailto:meskes@postgresql.org]
>> Sent: Tuesday, September 14, 1999 8:32 PM
>> To: Andreas Theofilu
>> Cc: Michael Meskes; pgsql-interfaces@postgresql.org
>> Subject: Re: [INTERFACES] ecpg and getting just assigned 
>> serial number
>> 
>> 
>> On Mon, Sep 13, 1999 at 02:11:24PM +0200, Andreas Theofilu wrote:
>> > Informix returns this number in 'sqlca.sqlerrd[1]'. 
>> Currently this field
>> > is not used by ecpg.
>> 
>> Added to TODO. But I doubt this can easily be implemented.
>> 
>> > Maybe ecpg can implement the first call behind the scenes 
>> and put the new
>> > serial number into 'sqlca.sqlerrd[1]'.
>> 
>> No. ECPG does not interpret any command. They are just fed 
>> into the backend.
>> 
>> After an insert the backend returns the number of records 
>> inserted, but does
>> it also return the OID or whatever? I'm not sure but since 
>> an insert could
>> add more than one tuple I doubt that.
>> 
>> 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!
>> 
>> ************
>> 


pgsql-interfaces by date:

Previous
From: Byron Nikolaidis
Date:
Subject: Re: [INTERFACES] Check boxes with Access
Next
From: Margarita Barvinok
Date:
Subject: Re: [INTERFACES] Transaction: Begin, Lock