Re: Autoincremental value - Mailing list pgsql-general

From Harald Fuchs
Subject Re: Autoincremental value
Date
Msg-id puhdr5yhoe.fsf@srv.protecting.net
Whole thread Raw
In response to Autoincremental value  (adburne@asocmedrosario.com.ar)
Responses Re: Autoincremental value  (adburne@asocmedrosario.com.ar)
List pgsql-general
In article <14610181509.20040813135048@asocmedrosario.com.ar>,
adburne@asocmedrosario.com.ar writes:

> 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
> ------+-------

Even MySQL disallows that - unless you use the MyISAM backend.  The
only time when I used this ugly hack was when I looked for a
workaround to the missing subselects.

Perhaps you should describe what you're trying to achieve.  I'm pretty
sure PostgreSQL has an elegant solution for that.

pgsql-general by date:

Previous
From: Arthur van Dorp
Date:
Subject: Web application: Programming language/Framework
Next
From: Jan Wieck
Date:
Subject: Re: PostgreSQL 8.0 Feature List?