Thread: "Current value" of sequences in the properties dialogue
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
Erwin Brandstetter wrote: > Hi developers! Hi Dave! > Hi Erwin, > 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've implemented that change as suggested. The existing code went out of it's way to behave as it did (using setval|('my_seq', 111, FALSE); on < 7.4 in fact!) so it was obviously a conscious design choice, but it's not one I can see any justification for! Cheers, Dave.
dpage@postgresql.org wrote: (...) > I've implemented that change as suggested. The existing code went out of > it's way to behave as it did (using setval|('my_seq', 111, FALSE); on < > 7.4 in fact!) so it was obviously a conscious design choice, but it's > not one I can see any justification for! > > Cheers, Dave. Nice! Additionally displaying the sequence's is_called flag in the properties is not an easy option, I assume? Congratulations on the newly released v 1.6.3, btw! Seems to be the best pgAdmin I have seen so far. :) Regards Erwin
Erwin Brandstetter wrote: > > dpage@postgresql.org wrote: > (...) >> I've implemented that change as suggested. The existing code went out of >> it's way to behave as it did (using setval|('my_seq', 111, FALSE); on < >> 7.4 in fact!) so it was obviously a conscious design choice, but it's >> not one I can see any justification for! >> >> Cheers, Dave. > > Nice! > Additionally displaying the sequence's is_called flag in the properties > is not an easy option, I assume? It's not a problem, it's just one of those things that inevitably leads to confusion amongst some users. > Congratulations on the newly released v 1.6.3, btw! Seems to be the best > pgAdmin I have seen so far. :) Thanks - thats usually the case with the back branches as we iron out all the bugs. We'll have a new release soon, with a whole new set of bugs for you to find :-p /D
dpage@postgresql.org wrote: > Erwin Brandstetter wrote: > >> (...) >> Nice! >> Additionally displaying the sequence's is_called flag in the properties >> is not an easy option, I assume? >> > > It's not a problem, it's just one of those things that inevitably leads > to confusion amongst some users. > Wouldn't you agree that it's more confusing, if the "Current value" is the last number normally, but sometimes, without indication, it may be the next? >> Congratulations on the newly released v 1.6.3, btw! Seems to be the best >> pgAdmin I have seen so far. :) >> > > Thanks - thats usually the case with the back branches as we iron out > all the bugs. We'll have a new release soon, with a whole new set of > bugs for you to find :-p More for me! :) Regards Erwin
Erwin Brandstetter wrote: > dpage@postgresql.org wrote: >> Erwin Brandstetter wrote: >> >>> (...) >>> Nice! >>> Additionally displaying the sequence's is_called flag in the properties >>> is not an easy option, I assume? >>> >> >> It's not a problem, it's just one of those things that inevitably leads >> to confusion amongst some users. >> > > > Wouldn't you agree that it's more confusing, if the "Current value" is > the last number normally, but sometimes, without indication, it may be > the next? Probably I guess :-p Change committed. Regards, Dave.