Re: serial

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Gustavo Rosso" <grosso(at)sadaic(dot)org(dot)ar>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: serial
Date: 2008-12-04 13:41:57
Message-ID: 162867790812040541h70f8e5e6hd5ba1fe621ea6489@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2008/12/4 Gustavo Rosso <grosso(at)sadaic(dot)org(dot)ar>:
> I created this table:
>
> create table se (n serial);
>
> Column | Type | Modifiers
> ---------+---------+------------------------------------------------
> n | integer | not null default nextval('se_n_seq'::regclass)
>
> I inserted two record, later select, but column n (serial) no
> auto-incremented
> banco=# select * from se;
> n
> ---
> 0
> 0
> (2 rows)
>

what is your insert statement?

postgres=#
postgres=# create table se(n serial);
NOTICE: CREATE TABLE will create implicit sequence "se_n_seq" for
serial column "se.n"
CREATE TABLE
postgres=# insert into se values(default);
INSERT 0 1
postgres=# insert into se values(default);
INSERT 0 1
postgres=# select * from se;
n
---
1
2
(2 rows)

regards
Pavel Stehule

> Why?
> Thanks
> Gustavo
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

  • serial at 2008-12-04 14:42:13 from Gustavo Rosso

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2008-12-04 13:43:28 Re: serial
Previous Message Grzegorz Jaśkiewicz 2008-12-04 13:37:51 Re: column name order matters in insert into foo from bar