Re: Autoincremental value

From: adburne(at)asocmedrosario(dot)com(dot)ar
To: Mage <mage(at)mage(dot)hu>, pgsql-general(at)postgresql(dot)org
Subject: Re: Autoincremental value
Date: 2004-08-17 11:57:59
Message-ID: 1428470504.20040817085759@asocmedrosario.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Estimado Mage,

Con fecha viernes 13 de agosto de 2004, 16.54.09, escribió:

M> adburne(at)asocmedrosario(dot)com(dot)ar wrote:

>>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
>>------+-------
>>
>>
M> Do you mean:

M> field1| field2
M> ------+-------
M> 1 | 1
M> 1 | 2
M> 2 | 3
M> ------+-------

M> You need the serial type.

M> Mage

Thnx to everybody for your answers; you put the finger on the key =), in
mysql you can create a mixed autoincremental on 2 fields, then the first
act as key and the second field is autoincremental based on the first
field. Like I wrote in the prev msg.

field1| field2
------+-------
1 | 1
1 | 2
2 | 1
------+-------

I was reading about serial type but I didn't find anything to do this
like mysql.

--
Saludos,
adburne
mailto:adburne(at)asocmedrosario(dot)com(dot)ar

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message adburne 2004-08-17 12:32:22 Re: Autoincremental value
Previous Message Pierre-Frédéric Caillaud 2004-08-17 11:35:35 Re: Web application: Programming language/Framework