pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Roy Souther <roy@SiliconTao.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Insert race hazard condition.
Date: Tue, 25 Mar 2003 14:07:59 -0600
Message-ID: <20030325200759.GB14216@wolff.to> (raw)
In-Reply-To: <1048622477.2643.44.camel@UtopiaPlanetia.Ept>
References: <1048622477.2643.44.camel@UtopiaPlanetia.Ept>

On Tue, Mar 25, 2003 at 13:01:17 -0700,
  Roy Souther <roy@SiliconTao.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.




view thread (4+ messages)  latest in thread

Message-ID: <20030325200759.GB14216@wolff.to>
Permalink:  ../20030325200759.GB14216@wolff.to/
Also on:    postgresql.org/message-id/20030325200759.GB14216@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, roy@SiliconTao.com
  Subject: Re: Insert race hazard condition.
  In-Reply-To: <20030325200759.GB14216@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox