Re: Equivalent for AUTOINCREMENT?

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: "Michelle Konzack" <linux4michelle(at)tamay-dogan(dot)net>
Cc: "pgSQL - General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Equivalent for AUTOINCREMENT?
Date: 2008-10-31 13:39:46
Message-ID: 2f4958ff0810310639occ0bfb0k8eab8ebe56e86a38@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

# create table foo( a SERIAL );
NOTICE: CREATE TABLE will create implicit sequence "foo_a_seq" for serial
column "foo.a"
CREATE TABLE

# \d+ foo
Table "public.foo"
Column | Type | Modifiers | Description
--------+---------+-------------------------------------------------+-------------
a | integer | not null default nextval('foo_a_seq'::regclass) |
Has OIDs: no

AUTOINCREMENT has so many problems, that soon you'll start to love sequences
so much, you'll start to hate mysql's childlish approach to problem solving
:)
Also make sure you read carefuly:
http://www.postgresql.org/docs/8.3/static/sql-createsequence.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-10-31 14:01:43 Re: Are there plans to add data compression feature to postgresql?
Previous Message Stephane Bortzmeyer 2008-10-31 13:31:32 Re: How to know the password for the user 'postgres'