pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ezequiel Tolnay <mail@etolnay.com.ar>
To: pgsql-sql@postgresql.org
Subject: Re: getting duplicate number is there a
Date: Tue, 17 May 2005 15:02:17 +1000
Message-ID: <d6btqq$24v7$1@news.hub.org> (raw)
In-Reply-To: <000e01c55a5f$4d912d00$797ba8c0@jfradkin>
References: <000e01c55a5f$4d912d00$797ba8c0@jfradkin>

You can select "for update", so you ensure that the rows are locked for 
your current transaction's use exclusively. If the rows in question had 
been modified by another ongoing transaction, then the select will get 
blocked until the other transaction is finished.

Cheers,

Ezequiel Tolnay
etolnay@gbtech.com.au

Joel Fradkin wrote:
> I was using SET TRANSACTION ISOLATION LEVEL SERIALIZABLE in MSSQL.
> 
> Is there something similar in postgres to ensure its not in the middle 
> of being updated?
> 
>             sql = "SELECT COUNT(*) FROM tblcase WHERE LocationID = " & 
> intLocationID & _
> 
>                   " and substr(casenum,length(casenum)-1,2) = '" & 
> right(year(date),2) & "' AND clientnum = '" & _
> 
>                   chrClientNum & "'"
> 
> I will add a select just before doing the insert to see if this helps, 
> its not happening a bunch, but 5 6 times a day is still an issue for me.
> 
> I use the count as a segment of my case number so each time a new case 
> is entered the count goes up for that location for that year.
> 
> Joel Fradkin



view thread (5+ messages)  latest in thread

Message-ID: <d6btqq$24v7$1@news.hub.org>
Permalink:  ../d6btqq$24v7$1@news.hub.org/
Also on:    postgresql.org/message-id/d6btqq$24v7$1@news.hub.org

 · 

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: mail@etolnay.com.ar
  Subject: Re: getting duplicate number is there a
  In-Reply-To: <d6btqq$24v7$1@news.hub.org>

* 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