Re: Does a the block of code within a stored procedure constitute

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: btober(at)seaworthysys(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Does a the block of code within a stored procedure constitute
Date: 2003-08-01 00:37:18
Message-ID: 1059698237.33557.8.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> What I need to know is whether or not this is multi-user safe, i.e., will
> the block of code in the procedure execute as a transaction so that if
> more than one clerk creates an expense report for the same employee
> simultaneously is it possible or impossible that value of the
> employee.expense_report_seq gets updated by the second clerk between the
> SELECT and UPDATE statements invoked by the first clerk?
>
> And as a follow-up, should I add the FOR UPDATE clause to the SELECT
> statement?

SELECT .. FOR UPDATE would be appropriate.

However, you could also do an update + 1 first and the select second to
find what you changed the value to.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2003-08-01 00:39:32 Re: select query that would join two databases
Previous Message Tom Lane 2003-08-01 00:36:22 Re: join optimization problem