Re: Autoincremental value - Mailing list pgsql-general

From adburne@asocmedrosario.com.ar
Subject Re: Autoincremental value
Date
Msg-id 1428470504.20040817085759@asocmedrosario.com.ar
Whole thread Raw
In response to Re: Autoincremental value  (Mage <mage@mage.hu>)
Responses Re: Autoincremental value
List pgsql-general
Estimado Mage,

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

M> adburne@asocmedrosario.com.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@asocmedrosario.com.ar


pgsql-general by date:

Previous
From: Pierre-Frédéric Caillaud
Date:
Subject: Re: Web application: Programming language/Framework
Next
From: adburne@asocmedrosario.com.ar
Date:
Subject: Re: Autoincremental value