Re: Modelling Oracle Sequences

From: Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com>
To: Julian North <jnorth(at)lastminute(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Modelling Oracle Sequences
Date: 2003-11-21 12:39:31
Message-ID: 3FBE0783.2090902@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Julian North wrote:

> Hi,
>
> I am in the process of porting a number of large MSSQL databases to
> Postgres.
>
> The current id generation model in SQL server is an oracle style sequence
> generator i wrote using a pretty simple stored proc and table structure.
>
> I now need to do the same thnig in postgres.
>
> In MSSQL I was able to open an UPDATE cursor, which places a lock on the row
> in the sequence table. I then update, release and return.
>
> Has anyone done something similar or have any pointers on how to do this
> safely, securely without an update cursor?

Are you trying to do this?

http://developer.postgresql.org/docs/postgres/functions-sequence.html

Sequence values are transaction safe in postgreql. You don't have to lock
anything to get a correct and unique sequence value.

HTH

Shridhar

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-11-21 12:40:31 Re: Concurrent testing PostgreSQL Vs MySQL
Previous Message Shridhar Daithankar 2003-11-21 12:30:35 Re: Concurrent testing PostgreSQL Vs MySQL