How to auto-increment?

From: Andre Lopes <lopes80andre(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to auto-increment?
Date: 2009-12-02 22:52:51
Message-ID: 18f98e680912021452p70f33530x72c37f6268535601@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a table like this:

id_product
id_increment

and I need to increment values in id_increment like this

prod_1
1

prod_1
2

prod_1
3

prod_2
1

Wich is the best way to do this? Using a trigger? Where can I find examples
of plpgsql doing this?

Best Regards, André.

Sorry for my bad english.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Williamson 2009-12-02 23:07:19 Re: How to auto-increment?
Previous Message Adrian Klaver 2009-12-02 22:49:15 Re: Catastrophic changes to PostgreSQL 8.4