Support for RETURNING xxx INTO yyy for INSERT and UPDATE?

Поиск
Список
Период
Сортировка
От John Napiorkowski
Тема Support for RETURNING xxx INTO yyy for INSERT and UPDATE?
Дата
Msg-id 20050223061124.69928.qmail@web30407.mail.mud.yahoo.com
обсуждение исходный текст
Ответы Re: Support for RETURNING xxx INTO yyy for INSERT and UPDATE?  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-novice
Does anyone know if Postgres supports some form of:

insert into mytable(column1,column2)
 values ('a','b')
 returning mytable_pk into :new_mytable_pk

Where 'mytable_pk' is defaulted to type of SERIAL?

I am really used to having this on Oracle, but can't
seem to find anything about it in the documentation or
searching around the mailing lists.

If not, what methods can I use to reliable and
efficiently return new primary keys from inserts?  I
am thinking I could use a function, but then I would
need to create one for each table in the database,
which seems really messy to me.

Sorry if this question has been answered somewhere
else. I figure it must have been, since this seems
like such a basic thing to me, but I just can't find
it :)

--john



__________________________________
Do you Yahoo!?
Yahoo! Sports - Sign up for Fantasy Baseball.
http://baseball.fantasysports.yahoo.com/

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

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Front End Languages for PostgreSQL
Следующее
От: Stefan.Ardeleanu@siveco.ro
Дата:
Сообщение: Help in dynamic execution in plpgsql