Re: "returning" in postgresql request

Поиск
Список
Период
Сортировка
От Matt Miller
Тема Re: "returning" in postgresql request
Дата
Msg-id 1118332976.3596.16.camel@dbamm01-linux
обсуждение исходный текст
Ответ на Re: "returning" in postgresql request  (Tino Wildenhain <tino@wildenhain.de>)
Список pgsql-general
> > deploy an Application with Oracle Database to a solution with postgresql.
> > ...
> > UPDATE xdb_ancestors_lock SET nb_lock=nb_lock+1 WHERE doc_id=? AND >
> > ele_id=? returning nb_lock INTO nb;

> Looks like you really want:
>
> UPDATE xdb_ancestors_lock SET nb_lock=nextval('nb_lock_sequence') WHERE
> doc_id=? AND ele_id=?;
> SELECT currval('nb_lock_sequence');


We have similar code in our Oracle-but-hopefully-soon-to-be-PostgreSQL
apps.  However, in our case the sequence generator is used in an insert
trigger to populate a column.  So, although I could use "currval" after
the insert to see what the trigger used, that would force the currval-
invoking code to know the internals of the insert trigger.  This is a
bit of an abstraction violation, I think.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Postgre "idle" process using 100% CPU
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: database auto-commit