Re: Autoincremental value

From: Ben <bench(at)silentmedia(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Autoincremental value
Date: 2004-08-13 19:53:23
Message-ID: Pine.LNX.4.44.0408131251170.17735-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yep, use the serial datatype. And then use the helpful documention. :)

http://www.postgresql.org/docs/7.4/static/datatype.html#DATATYPE-SERIAL
http://www.postgresql.org/docs/faqs/FAQ.html#4.15.2

On Fri, 13 Aug 2004 adburne(at)asocmedrosario(dot)com(dot)ar wrote:

> Hi I'm a newbie in postgresql, I came from MSSQL, MySQL and now
> I'm testing postgres.
> In mysql there is a way to make a second autoincrement field, just:
>
> create table table1
> (field1 integer,
> field2 integer autoincrement,
> primary key (field1,field2))
>
> when insert rows:
>
> insert into table1 (field1) values (1);
> insert into table1 (field1) values (1);
> insert into table1 (field1) values (2);
>
> and then select * from table1, you get:
> field1| field2
> ------+-------
> 1 | 1
> 1 | 2
> 2 | 1
> ------+-------
>
> there is a way to do this with postgres???
>
> thnx!!!!
>
> --
> Saludos,
> adburne
> mailto:adburne(at)asocmedrosario(dot)com(dot)ar
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mage 2004-08-13 19:54:09 Re: Autoincremental value
Previous Message David Garamond 2004-08-13 19:18:59 psql wishlist: value completion