Re: creating a table with a serial column sets currval

From: Kris Jurka <books(at)ejurka(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: creating a table with a serial column sets currval
Date: 2007-10-18 20:23:59
Message-ID: Pine.BSO.4.64.0710181622170.12647@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 18 Oct 2007, Kris Jurka wrote:

>
> jurka=# create table t (c serial);
> NOTICE: CREATE TABLE will create implicit sequence "t_c_seq" for serial
> column "t.c"
> CREATE TABLE
> jurka=# select currval('t_c_seq');
> currval
> ---------
> 1
> (1 row)
>
> I would expect it to say that currval wasn't set like so:
>

Looks like any alter sequence command will do this. The serial case uses
alter sequence owned by under the hood which exposes this. The problem is
that altering the sequence puts it into the SeqTable cache list when it
really shouldn't be.

Kris Jurka

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2007-10-18 20:48:45 Re: creating a table with a serial column sets currval
Previous Message Kris Jurka 2007-10-18 20:10:46 creating a table with a serial column sets currval