getting back "rowid" after an insert...

From: Mark Dzmura <mdz(at)digital-mission(dot)com>
To: "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: getting back "rowid" after an insert...
Date: 2000-09-07 02:41:20
Message-ID: 39B70050.76E3EB0C@digital-mission.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I have the exact same issue as Alec, below, except it's even worse: in some of my situations,
I can't even do a meaningful query to get the record I just inserted, since there is no unique key
other than the "serial" primary key obtained from the sequence...

I can think of a couple of ways to get the most recent transaction (get the value from the
sequence, or do a select id order by timestamp desc limit 1), but would have to guarantee
atomicity to get the data corresponding to the row I just inserted...I could use a transaction
just to guarantee that no records are added between my insert and my select, but that seems
like a horrendous waste (since so many databases are ready to just hand me a rowid or oid
after an insert...)

Can anybody help us out here??

Regards,
Mark Dzmura

>> Hi,
>>
>> It appears that the JDBC insert row feature has not been implemented. Is there any news on when this is planned?
>>
>> I was planning on using this feature to determine the value of an automatically-assigned primary key column when a
>> single row is inserted without having to do a query following the insertion, although I'm not sure if default
>> values are assigned to the insert row according to the JDBC spec. Is there an easy way to do this without the
>> insert row feature?

--
)))) This email routed via a wireless gateway!! ((((

Attachment Content-Type Size
mdz.vcf text/x-vcard 280 bytes

Browse pgsql-interfaces by date

  From Date Subject
Next Message Mark Dzmura 2000-09-07 03:15:02 obtaining primary key/rowid following insert, redux...
Previous Message Ken Kachnowich 2000-09-06 22:04:25 Performance issue with JDBC