Get last serial (autoincrement) value

Поиск
Список
Период
Сортировка
От Andrei Verovski (aka MacGuru)
Тема Get last serial (autoincrement) value
Дата
Msg-id DF9C8135-DC67-11D7-B235-000A959C9730@starlett.lv
обсуждение исходный текст
Ответы Re: Get last serial (autoincrement) value  (Frank Bax <fbax@sympatico.ca>)
Re: Get last serial (autoincrement) value  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-php
Hi,

Anyone knows how to obtain last inserted serial (autoincrement) id? I
am currently using "SELECT id FROM table_name ORDER BY id DESC", and
then retrieve first row and desired value.

May be there is more elegant way? I am using ADODB. ADODB has function
which in theory allows to obtain
last inserted serial (autoincrement) id, but for Postgres it return OID.

This is from ADODB manual:

Insert_ID( )
Returns the last autonumbering ID inserted. Returns false if function
not supported.
Only supported by databases that support auto-increment or object id's,
such as PostgreSQL, MySQL and MSSQL currently. PostgreSQL returns the
OID, which can change on a database reload.


Thanks in advance for any suggestion.


*********************************************
*   Best Regards   ---   Andrei Verovski
*
*   Personal Home Page
*   http://snow.prohosting.com/guru4mac
*   Mac, Linux, DTP, Development, IT WEB Site
*********************************************


В списке pgsql-php по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: write to next-Page on PHP with Pdflib
Следующее
От: "David Busby"
Дата:
Сообщение: Re: Get last serial (autoincrement) value