Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: 31 Jul 2003 20:37:18 -0400
  • Message-id: <1059698237.33557.8.camel@jester> <text/plain>

> 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.

Attachment: signature.asc
Description: This is a digitally signed message part



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group