Re: Equivalent for AUTOINCREMENT?

From: Michelle Konzack <linux4michelle(at)tamay-dogan(dot)net>
To: Nikolas Everett <nik9000(at)gmail(dot)com>
Cc: pgSQL - General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Equivalent for AUTOINCREMENT?
Date: 2008-11-01 13:24:37
Message-ID: 20081101132437.GD3514@tamay-dogan.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Nikolas,

Am 2008-10-31 09:44:50, schrieb Nikolas Everett:
> I think you want a sequence. Give the serial number the type bigserial or
> serial. See
> http://www.postgresql.org/docs/current/static/functions-sequence.html for
> more.

OK, thats cool... I have found an example in "sql-createsequence.html"

CREATE SEQUENCE serial START 1;

INSERT INTO distributors VALUES (nextval('serial'), 'nothing');

But there is one thing not clear:

Du I need to create a SEQUENCE for each table or do I need only ONE of
if and can use it independant on differnt tables?

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant

--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
+49/177/9351947 50, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Konzack 2008-11-01 13:44:30 Re: Equivalent for AUTOINCREMENT?
Previous Message Gregory Stark 2008-11-01 13:02:24 Re: Are there plans to add data compression feature to postgresql?