Re: Bug with sequence - Mailing list pgsql-general

From Lee Harr
Subject Re: Bug with sequence
Date
Msg-id arc3of$1c2a$1@news.hub.org
Whole thread Raw
List pgsql-general
In article <92c0776e.0211180745.49911131@posting.google.com>,
Thomas Aichinger wrote:
> Hi,
>
> I recently installed pg 7.2.3 on my linux box and discovered that
> there are some problems with datatype serial and sequence.
>
> 1.) If you create a table with a datatype serial, the corrsponding
> sequence will be created, but if you drop the table the sequence is
> not dropped.
>

I am pretty sure this has been fixed in version 7.3 (due to be
release real soon now.)


> 2.) If you create a sequence and grant it to public one cant use
> currval() until one used setval() or nextval().
> "ERROR:  midnr.currval is not yet defined in this session"
>

This is actually the way sequences work (ie, it's a feature, not
a bug, heh heh)

currval() gives you the current value of the sequence
*as seen in this session*  ... so until you do a setval()
or a nextval() there is no value seen by this session.


> 3.) Sometimes one gets 'not enogh privileges' error when using
> nexval()
>

nextval()? hmm. well. If the user does not have privelege to
update the sequence, then the call will fail.

>
> Am I the first one who discovered that?
>

Nah, and probably not the first one to avoid the FAQ either.
heh heh.


pgsql-general by date:

Previous
From: Brian Minton
Date:
Subject: Re: signed/unsigned integers
Next
From: "Daniel S. Myers"
Date:
Subject: Query optimization question