Re: BUG #17428: last_value incorrect for uninitialized sequence

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17428: last_value incorrect for uninitialized sequence
Дата
Msg-id 189261.1646664485@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #17428: last_value incorrect for uninitialized sequence  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: BUG #17428: last_value incorrect for uninitialized sequence  (Glen Edmonds <glen.edmonds@gmail.com>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Mon, Mar 7, 2022 at 12:15 AM PG Bug reporting form <
> noreply@postgresql.org> wrote:
>> For a freshly defined sequence, the following:
>> select last_value from mytable_id_seq
>> should return 0, but returns 1.

> One seems as good a choice as zero if a non-null value is to be returned.

The larger point here is that any change is much more likely to
break applications expecting the historical behavior than it is
to make anyone's life better.  In a green field I'd tend to
agree that returning NULL (and dispensing with is_called) would
be a better design, but that opportunity was missed decades ago.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #17428: last_value incorrect for uninitialized sequence
Следующее
От: Glen Edmonds
Дата:
Сообщение: Re: BUG #17428: last_value incorrect for uninitialized sequence