Lists: | pgsql-general |
---|
From: | Yesh <rengesh2k3(at)yahoo(dot)co(dot)in> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | About auto_increment |
Date: | 2007-01-02 05:21:33 |
Message-ID: | 8120183.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hi,
I need to know how to increment a primary key field automatically in run
time.
--
View this message in context: http://www.nabble.com/About-auto_increment-tf2906530.html#a8120183
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Yesh <rengesh2k3(at)yahoo(dot)co(dot)in> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: About auto_increment |
Date: | 2007-01-02 15:54:03 |
Message-ID: | 459A801B.3020109@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Yesh wrote:
> Hi,
>
> I need to know how to increment a primary key field automatically in run
> time.
Not sure precisely what you want to know, but read up on the SERIAL
type, sequences, nextval() and currval().
--
Richard Huxton
Archonet Ltd
From: | "Raymond O'Donnell" <rod(at)iol(dot)ie> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: About auto_increment |
Date: | 2007-01-02 15:54:08 |
Message-ID: | 459A8020.22087.93F457@rod.iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 1 Jan 2007 at 21:21, Yesh wrote:
> I need to know how to increment a primary key field automatically in
> run time.
Use type SERIAL as your primary key - here is the relevant page in
the docs:
http://www.postgresql.org/docs/8.2/static/datatype-
numeric.html#DATATYPE-SERIAL
HTH,
--Ray.
----------------------------------------------------------------------
Raymond O'Donnell
Director of Music, Galway Cathedral, Galway, Ireland
rod(at)iol(dot)ie
----------------------------------------------------------------------
From: | James Neff <jneff(at)tethyshealth(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: About auto_increment |
Date: | 2007-01-02 16:00:23 |
Message-ID: | 459A8197.1040603@tethyshealth.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Yesh wrote:
> Hi,
>
> I need to know how to increment a primary key field automatically in run
> time.
>
>
If you use the "serial" data type, the database does this for you
automatically and you don't have to worry about it.
Is this the data type your using?
--
James Neff
Technology Specialist
Tethys Health Ventures
4 North Park Drive, Suite 203
Hunt Valley, MD 21030
office: 410.771.0692 x103
cell: 443.865.7874
From: | Ragnar <gnari(at)hive(dot)is> |
---|---|
To: | Yesh <rengesh2k3(at)yahoo(dot)co(dot)in> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: About auto_increment |
Date: | 2007-01-02 16:05:38 |
Message-ID: | 1167753938.6369.416.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On mán, 2007-01-01 at 21:21 -0800, Yesh wrote:
> I need to know how to increment a primary key field automatically in run
> time.
Will SERIAL do what you want?
gnari
From: | Yesh <rengesh2k3(at)yahoo(dot)co(dot)in> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: About auto_increment |
Date: | 2007-01-03 03:54:05 |
Message-ID: | 8135523.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hi,
Thankx guys I am now able to increment that field by using serial.
Richard Huxton wrote:
>
> Yesh wrote:
>> Hi,
>>
>> I need to know how to increment a primary key field automatically in
>> run
>> time.
>
> Not sure precisely what you want to know, but read up on the SERIAL
> type, sequences, nextval() and currval().
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
--
View this message in context: http://www.nabble.com/About-auto_increment-tf2906530.html#a8135523
Sent from the PostgreSQL - general mailing list archive at Nabble.com.