pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Glen Edmonds <glen.edmonds@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17428: last_value incorrect for uninitialized sequence
Date: Mon, 07 Mar 2022 10:23:42 -0500
Message-ID: <192171.1646666622@sss.pgh.pa.us> (raw)
In-Reply-To: <CALqkxFMZ2LuM1YYNL6CTSqPz4Zxw+i9OvKYkMMnyLG7LmoPs0Q@mail.gmail.com>
References: <17428-848dee31a3b899ab@postgresql.org>
	<CAKFQuwaZ06rmQQsdZh3zQoeTby7=Yu0Pp=z5ts+5iGo80-EXyw@mail.gmail.com>
	<189261.1646664485@sss.pgh.pa.us>
	<CALqkxFMZ2LuM1YYNL6CTSqPz4Zxw+i9OvKYkMMnyLG7LmoPs0Q@mail.gmail.com>

Glen Edmonds <glen.edmonds@gmail.com> writes:
> The problem really is that the two states of not initialized and post first
> usage are indistinguishable (both return 1), but the sequence next value is
> different.

They're not indistinguishable: if you look at the is_called flag
you'll see that it changes.

> ie it’s a reasonable expectation that the next value is
> last_value + 1. IMHO violating this makes it a bug.

You can call it that if you like, but it's operating as designed
and documented.  I fear it's about twenty years too late to propose
a redesign.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <192171.1646666622@sss.pgh.pa.us>
Permalink:  ../192171.1646666622@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/192171.1646666622@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, glen.edmonds@gmail.com, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17428: last_value incorrect for uninitialized sequence
  In-Reply-To: <192171.1646666622@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox