Re: MySQL LAST_INSERT_ID() to Postgres

Поиск
Список
Период
Сортировка
От Russ Brown
Тема Re: MySQL LAST_INSERT_ID() to Postgres
Дата
Msg-id 48B701B9.8010303@gmail.com
обсуждение исходный текст
Ответ на MySQL LAST_INSERT_ID() to Postgres  ("Masis, Alexander \(US SSA\)" <alexander.masis@baesystems.com>)
Ответы Re: MySQL LAST_INSERT_ID() to Postgres  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-general
Masis, Alexander (US SSA) wrote:
>
>    "SELECT CURRVAL(
> pg_get_serial_sequence('my_tbl_name','id_col_name'));"
>

Any reason why you can't just do this?

CREATE FUNCTION last_insert_id() RETURNS bigint AS $$
  SELECT lastval();
$$ LANGUAGE SQL VOLATILE;

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

Предыдущее
От: Alan Hodgson
Дата:
Сообщение: Re: WAL file questions - how to relocate on Windows, how to replay after total loss, etc
Следующее
От: "Douglas McNaught"
Дата:
Сообщение: Re: WAL file questions - how to relocate on Windows, how to replay after total loss, etc