Re: Using oid as pkey

Поиск
Список
Период
Сортировка
От Rainer Bauer
Тема Re: Using oid as pkey
Дата
Msg-id 6v7kc3l5n3kv0veja3i173dtul0f3co548@4ax.com
обсуждение исходный текст
Ответ на Using oid as pkey  ("Ed L." <pgsql@bluepolka.net>)
Ответы Re: Using oid as pkey
Список pgsql-general
"D. Dante Lorenso" wrote:

>Using a brain-dead sample table that looks like this:
>
>    CREATE table some_table (
>        col0 SERIAL,
>        col1 VARCHAR,
>        col2 VARCHAR
>    );
>
>I want to do something like this:
>
>    INSERT INTO some_table (col1, col2)
>    VALUES ('val1', 'val2');
>
>I want the value of col0 returned to the application and I don't want to
>know the name of the sequence involved in the SERIAL column.  I just
>want the value inserted into the column by using just it's column name.

Using 8.2 or above:
INSERT INTO some_table (col1, col2) VALUES ('val1', 'val2') RETURNING col0;

Rainer

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Using oid as pkey
Следующее
От: "Joey K."
Дата:
Сообщение: Re: Seeking datacenter PITR backup procedures [RESENDING]