Re: problem fetching currval of sequence

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: problem fetching currval of sequence
Дата
Msg-id web-1602018@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на problem fetching currval of sequence  (Charles Hauser <chauser@duke.edu>)
Ответы Re: problem fetching currval of sequence
Re: problem fetching currval of sequence
Список pgsql-sql
Charles,

> I have a script to load values into a table (gb) which contains a
> SEQUENCE ('gb_id').  For each entry into TABLE gb I need the value of
> 'gb_gb_id_seq' to update a relational table.   I am getting the
> following error msg:
>   ERROR: gb_gb_id_seq.currval is not yet defined in this session.

Sometime in the upgrade process for 7.1.0 --> 7.2.1, the CURRVAL
function changed so that it was rigorously session-specific.  I can see
a number of good reasons for doing this, but it has the unfortunate
side effect that CURRVAL is virtually useless for querying the current
value of the row you just inserted using a front-end that creates a new
session for each command.   

I'd love to hear Tom, Bruce, or Stephan's comments on the issue.  It is
an annoyance, and it would be nice to know the reason for the decrease
in functionality of CURRVAL.

All that aside, the first query you are sending to Postgres is an
UPDATE query, not an INSERT.  So what good was CURRVAL going to do you
anyway?   

-Josh Berkus




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

Предыдущее
От: Joerg Hessdoerfer
Дата:
Сообщение: Re: Table design question...
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: problem fetching currval of sequence