Re: getting duplicate number is there a

From: Ezequiel Tolnay <mail(at)etolnay(dot)com(dot)ar>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: getting duplicate number is there a
Date: 2005-05-17 05:02:17
Message-ID: d6btqq$24v7$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)gbtech(dot)com(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-05-17 07:11:35 Re: getting duplicate number is there a
Previous Message Joel Fradkin 2005-05-16 21:36:21 getting duplicate number is there a