Thread: ROWID ? or other internal ID
I'm beginner with postgresql. In other database like ORACLE or PROGRESS you've got an internal identifier ROWID or RECID (bookmark with access) which allow you to select a row very quickly or to go back to a specific row very quickly. these functions uses an internal ID. Does something approaching that exist under postgresql ? I've search and found nothing except "SERIAL" but that's not an internal ID. thanks, Stéphane Valcauda
You want OID as in: Select OID, * from table; valcauda Stéphane wrote: > > I'm beginner with postgresql. > In other database like ORACLE or PROGRESS you've got an internal identifier > ROWID or RECID > (bookmark with access) which allow you to select a row very quickly or to go > back to a specific row very quickly. > these functions uses an internal ID. > > Does something approaching that exist under postgresql ? > I've search and found nothing except "SERIAL" but that's not an internal ID. > > thanks, > > Stéphane Valcauda > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
=?iso-8859-1?Q?valcauda_St=E9phane?= <valcauda.aderis@wanadoo.fr> writes: > In other database like ORACLE or PROGRESS you've got an internal identifier > ROWID or RECID > (bookmark with access) which allow you to select a row very quickly or to go > back to a specific row very quickly. > these functions uses an internal ID. CTID allows direct access to a row --- but it's invalidated by an update, so it might not be very useful for you. regards, tom lane
Hi! I'm new in postgresql-ODBC but not in postgresql. I use it with PHP long time ago. I use OID for selecting and also for referencing rows. For this I need to know the OID of the last inserted row. In php I have getlastoid function for this. I tried "insert" then "select :LASTOID" with ODBC but it has returned with error. (I tried it in the same connection) How can I get the OID of last inserted row with ODBC? Thanks Zoltan On Tue, 8 Oct 2002, Jean-Luc Lachance wrote: > You want OID as in: > > Select OID, * from table; ___________________________________________________________________________ Nagy Zoltan iloz@falcon.sch.bme.hu Phone: +36-30-2699112
In PL/pgSQL you can : GET DIAGNOSTICS {variable} = RESULT_OID; to get the OID of the previous INSERTed, DELETEd or UPDATEd row. JLL iloz@recursor.hu wrote: > > Hi! > > I'm new in postgresql-ODBC but not in postgresql. I use it with PHP long > time ago. > I use OID for selecting and also for referencing rows. For this I need to > know the OID of the last inserted row. In php I have getlastoid function > for this. > I tried "insert" then "select :LASTOID" with ODBC but it has returned with > error. (I tried it in the same connection) > How can I get the OID of last inserted row with ODBC? > > Thanks > Zoltan > > On Tue, 8 Oct 2002, Jean-Luc Lachance wrote: > > > You want OID as in: > > > > Select OID, * from table; > > ___________________________________________________________________________ > Nagy Zoltan iloz@falcon.sch.bme.hu Phone: +36-30-2699112 > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly
Ok, but how can I use this with ODBC? On Wed, 9 Oct 2002, Jean-Luc Lachance wrote: > In PL/pgSQL you can : > > GET DIAGNOSTICS {variable} = RESULT_OID; > > to get the OID of the previous INSERTed, DELETEd or UPDATEd row. > > JLL > > > iloz@recursor.hu wrote: > > > > Hi! > > > > I'm new in postgresql-ODBC but not in postgresql. I use it with PHP long > > time ago. > > I use OID for selecting and also for referencing rows. For this I need to > > know the OID of the last inserted row. In php I have getlastoid function > > for this. > > I tried "insert" then "select :LASTOID" with ODBC but it has returned with > > error. (I tried it in the same connection) > > How can I get the OID of last inserted row with ODBC? > > > > Thanks > > Zoltan ___________________________________________________________________________ Nagy Zoltan iloz@falcon.sch.bme.hu Phone: +36-30-2699112
Just create a stored procedure that returns RESULT_OID; iloz@recursor.hu wrote: > > Ok, but how can I use this with ODBC? > > On Wed, 9 Oct 2002, Jean-Luc Lachance wrote: > > > In PL/pgSQL you can : > > > > GET DIAGNOSTICS {variable} = RESULT_OID; > > > > to get the OID of the previous INSERTed, DELETEd or UPDATEd row. > > > > JLL > > > > > > iloz@recursor.hu wrote: > > > > > > Hi! > > > > > > I'm new in postgresql-ODBC but not in postgresql. I use it with PHP long > > > time ago. > > > I use OID for selecting and also for referencing rows. For this I need to > > > know the OID of the last inserted row. In php I have getlastoid function > > > for this. > > > I tried "insert" then "select :LASTOID" with ODBC but it has returned with > > > error. (I tried it in the same connection) > > > How can I get the OID of last inserted row with ODBC? > > > > > > Thanks > > > Zoltan > > ___________________________________________________________________________ > Nagy Zoltan iloz@falcon.sch.bme.hu Phone: +36-30-2699112 > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org