On Oct 22, 2008, at 3:20 PM, Sean Thayne wrote:

Thanks, that's a bummer, wonder by Postgres doesn't have a feature like
this. Don't most database servers have a equivalent function?


It's just done differently. Instead of making the auto number feature a column attribute, it's done as a separate object (called a sequence).

In MySQL you'd follow something like this:

        - Insert new data
        - Ask for the auto number ID for the data we just inserted

In PostgreSQL (and any other DB that uses sequences, like Oracle) the order would be switched:

        - Ask for a new auto number ID from the sequence
        - Insert the new data, using the ID we got from the sequence

That said it's pretty common in PostgreSQL to make an auto number field who's default value is to select the next number from the sequence.

--
Joseph Scott
[EMAIL PROTECTED]
http://joseph.randomnetworks.com/




_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to