Re: Auto Increment Questions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Avila <mavila(at)mich(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Auto Increment Questions
Date: 2005-06-04 18:40:03
Message-ID: 200506041840.j54Ie3S22772@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


How is SERIAL not automatic? Have you read the FAQ?

---------------------------------------------------------------------------

Michael Avila wrote:
> I am currently working on a project that may be used throughout the United
> States. I have created the project database in MySQL but have been looking
> at Postgres due to it being completely free. The application will be web
> based and the language with primarily be PHP.
>
> In MySQL there is the availability of an auto increment field. I need this
> type of field in several of the tables. Looking in the archives, I see that
> there is a serial 8 filed that basically does the same thing. In MySQL, auto
> increment is just that - automatically incremented for each new record.
>
> In Postgres I see that it is not so automatic and is not truly
> serial/sequential. Reviewing my objectives, I don't think not being truly
> serial/sequential will be a problem. However, I prefer the automated part
> versus my having to code additional lines and hits against the database.
>
> Questions:
>
> - Is there ever going to be a truly auto increment feature like MySQL has?
> If so, any ideas when?
>
> - What is the easiest, shortest, and safest way to code for serial?
>
> - Are there any pitfalls, gotchas that I need to know about using serial?
>
> Thank you for your help.
>
> Mike
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.323 / Virus Database: 267.6.1 - Release Date: 6/3/2005
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Avila 2005-06-04 22:53:54 Data Store on C:
Previous Message Michael Avila 2005-06-04 18:35:02 Auto Increment Questions