From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Thomas Aichinger <taich(at)gmx(dot)at> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Bug with sequence |
Date: | 2002-11-20 08:53:11 |
Message-ID: | 1037782392.29678.88.camel@linda |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers pgsql-sql |
On Mon, 2002-11-18 at 15:45, 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.
This is fixed in 7.3
> 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 how it is intended to work. Read the manual...
And it is nothing to do with its being granted to public; it is
fundamental to what currval() does, which is to provide the last value
given by nextval() *in*the*current*session*. If there has been no use
of nextval(), currval() cannot report anything.
If you want the last value given by anyone on the sequence, you could
use "select last_value from <sequence_name>", but that would not give
you anything done by uncompleted transactions. That's why currval()
exists.
> 3.) Sometimes one gets 'not enogh privileges' error when using
> nexval()
When the sequence is created, you need to grant access rights on it to
other users who will need it.
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"If my people, which are called by my name, shall
humble themselves, and pray, and seek my face, and
turn from their wicked ways; then will I hear from
heaven, and will forgive their sin, and will heal
their land." II Chronicles 7:14
From | Date | Subject | |
---|---|---|---|
Next Message | Yves Bastide | 2002-11-20 12:42:23 | Re: Handling images using Python |
Previous Message | Damjan Pipan | 2002-11-20 07:24:20 | modifying new tuple on insert in c trigger |
From | Date | Subject | |
---|---|---|---|
Next Message | Reinoud van Leeuwen | 2002-11-20 12:03:18 | Why an array in pg_group? |
Previous Message | Tom Lane | 2002-11-20 06:27:45 | Re: PREPARE and parameter types (Re: [INTERFACES] DBD::PostgreSQL) |
From | Date | Subject | |
---|---|---|---|
Next Message | Luis Sousa | 2002-11-20 09:38:46 | Re: Problems invoking psql. Help please. |
Previous Message | Michiel Lange | 2002-11-20 07:40:11 | Re: Problems invoking psql. Help please. |