Re: Re: Re: Rules, views, sequences and returned values

Поиск
Список
Период
Сортировка
От will trillich
Тема Re: Re: Re: Rules, views, sequences and returned values
Дата
Msg-id 20010323161156.B20799@mail.serensoft.com
обсуждение исходный текст
Ответ на Re: Re: Rules, views, sequences and returned values  ("Gregory Wood" <gregw@com-stock.com>)
Ответы Re: Re: Re: Rules, views, sequences and returned values
Re: Re: Re: Rules, views, sequences and returned values
Список pgsql-general
On Fri, Mar 23, 2001 at 12:23:35PM -0500, Gregory Wood wrote:
> > i'm sure there's a reason for this--
> >
> > psql=> select currval('mytable_afield_seq') ;
> > ERROR:  mytable_afield_seq.currval is not yet defined in this session
> >
> > but i'll be darned if i can figure out what it is. (after one
> > call to "nextval()" currval() works fine, of course.) someone hit
> > me with a clue stick!
>
> currval() is the value last used by the backend, not by the database.
> Meaning that you have to actually use the sequence before the backend has a
> value to retrieve. That means either doing a nextval() or doing an INSERT
> (which implicitly performs the nextval() ).

<dense mode=on>
seems like the backend (server?) would know the current value of
a sequence, since it has to get it, then add one to it, to get
the next one in line. if george inserts a record, i'd think that
ringo would be able to see the current counter afterwards,
independent of session...

so i can't retrieve and use the existing current value for a
sequence unless i bump it one? me no grok.
</dense>

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
        -- Isaac Asimov, 'The Genetic Code'

will@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

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

Предыдущее
От: "Matt Friedman"
Дата:
Сообщение: Vacuum VS Vacuum Analyze
Следующее
От: "Matt Friedman"
Дата:
Сообщение: ~* OR LIKE?