Re: Defining and Using variables in a postgres function - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Defining and Using variables in a postgres function
Date
Msg-id 20070202182054.GA6468@wolff.to
Whole thread Raw
In response to Re: Defining and Using variables in a postgres function  (Alban Hertroys <alban@magproductions.nl>)
List pgsql-general
On Fri, Feb 02, 2007 at 17:18:39 +0100,
  Alban Hertroys <alban@magproductions.nl> wrote:
>
> You can do this:
> INSERT INTO tbl_email (option_public, agency, id)
>     SELECT $1, $2, MAX(id) + 1
>     FROM xyz;
>
> I just realize you don't so much need a lock, you need a serialized
> transaction. I can't say I know a lot about locks, I usually prevent
> needing them.

No, a serialized transaction isn't good enough. You need predicate locking,
which postgres doesn't have. So you need to use lock table to do effectively
the same thing with a more blunt instrument.

pgsql-general by date:

Previous
From: pgsql-user
Date:
Subject: Rule, update and aggregate functions
Next
From: Mark Walker
Date:
Subject: Re: Rule, update and aggregate functions