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: creating a table with a serial column sets currval
Date: 2007-10-18 20:10:46
Message-ID: Pine.BSO.4.64.0710181606530.12647@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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:

jurka=# create sequence myseq;
CREATE SEQUENCE
jurka=# select currval('myseq');
ERROR: currval of sequence "myseq" is not yet defined in this session

Kris Jurka

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2007-10-18 20:23:59 Re: creating a table with a serial column sets currval
Previous Message Julius Stroffek 2007-10-18 13:20:05 Re: 'on insert do instead' rule with a where clause responds 'INSERT 0 0'