From: | Harald Fuchs <hf0722x(at)protecting(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Autoincremental value |
Date: | 2004-08-14 13:26:25 |
Message-ID: | puhdr5yhoe.fsf@srv.protecting.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In article <14610181509(dot)20040813135048(at)asocmedrosario(dot)com(dot)ar>,
adburne(at)asocmedrosario(dot)com(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2004-08-14 16:03:21 | Re: PostgreSQL 8.0 Feature List? |
Previous Message | Arthur van Dorp | 2004-08-14 13:10:48 | Web application: Programming language/Framework |