"Current value" of sequences in the properties dialogue

From: Erwin Brandstetter <brandstetter(at)falter(dot)at>
To: pgadmin-support(at)postgresql(dot)org
Subject: "Current value" of sequences in the properties dialogue
Date: 2007-03-26 22:22:23
Message-ID: 4608479F.8030801@falter.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi developers! Hi Dave!

Testing pgAdmin III v1.6.3 rev: 5941, client Win XP, host: Debian Sarge,
PG 8.1.8.

I have noted a peculiarity with seuqences.

If I change the "Current value" in the properties dialogue of a sequence
to a new value (111 in my example) pgAdmin sends this SQL statement to
the server:
ALTER SEQUENCE my_seq RESTART WITH 111;
which sets the "is_called" field of the sequence to FALSE. So the next
value obtained from the sequence will be 111.

The "is_called" field of sequence, which is TRUE during normal
operation, is not shown in the porperties. The number in "Current value"
normally is the LAST number obtained from the sequence. In this
particular case, however, it is the NEXT number that will be |given to a
||nextval|('my_seq') call. But a user could not tell from what is shown
in the properties.

Also, it is not possible to set the sequence to the number shown in
"Current value" (effectively only changing "is_called" TO FALSE) because
pgAdmin thinks no change is being made. A way to get around this is to
set it to an arbitrary number first, and then back to the previous
number, which then will be next number ("is_called" being FALSE now).

It would help to either display the "is_called" field, or consistently
show either the next or the current value of a sequence.
User-manipulation of the "Current value" field would probably require
additional intelligence behind it then.

It might help to use
| setval|('my_seq', 111, TRUE);
or just
| setval|('my_seq', 111);
as this would set "is_called" to true and thus generate a more
consistant behaviour. "is_called" could still be set to FALSE by users,
though.

I think it is a bit unfortunate, that "ALTER SEQUENCE my_seq RESTART
WITH 111" sets "is_called" to FALSE, while the default behaviour of
setval (..) ist to set it to TRUE.

Regards
Erwin

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message palmerj 2007-03-26 23:37:36 bug in edit grid
Previous Message Dave Page 2007-03-26 20:08:47 Re: accent error