Re: Insert race hazard condition.

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Roy Souther <roy(at)SiliconTao(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Insert race hazard condition.
Date: 2003-03-25 20:07:59
Message-ID: 20030325200759.GB14216@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Mar 25, 2003 at 13:01:17 -0700,
Roy Souther <roy(at)SiliconTao(dot)com> wrote:
> First of all I am a programmer not an DBA expert.
>
> For a long time now when I create a table I have an index field that is
> of type int4 to be the primary key. All of the queries and activity on
> each record uses this field to do the posting, manipulating and reading
> of data to and from tables.

[snip]

> Is there a better way to do this? How do DBAs with a lot of connections
> safely create new records?

The short answer is to use sequences. Use currval to get the value assigned
earlier in the same transaction.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-03-25 20:10:05 Re: Insert race hazard condition.
Previous Message Roy Souther 2003-03-25 20:01:17 Insert race hazard condition.