Re: Autoincremental value

Поиск
Список
Период
Сортировка
Искать
От
Harald Fuchs
Тема
Re: Autoincremental value
Дата
Msg-id
puhdr5yhoe.fsf@srv.protecting.net
Список
Дерево обсуждения
Re: Autoincremental value Harald Fuchs <hf0722x@protecting.net>
Re: Autoincremental value adburne@asocmedrosario.com.ar
Re: Autoincremental value Pierre-Frédéric Caillaud<lists@boutiquenumerique.com>
Re: Autoincremental value "Scott Marlowe" <smarlowe@qwest.net>
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 по дате отправления
От: Arthur van Dorp
Дата:
От: Jan Wieck
Дата:
FAQ