Re: pgplsql SELECT INTO ... FOR UPDATE

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: Eric Brown <eric(dot)brown(at)propel(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pgplsql SELECT INTO ... FOR UPDATE
Date: 2004-12-15 12:34:53
Message-ID: 1103114093.4086.4.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2004-12-15 at 01:38 -0800, Eric Brown wrote:
>
>
> ______________________________________________________________________
>
> I'm trying to write a stored procedure in plpgsql that selects a row
> and possibly increments one of its fields. I thought I would do SELECT
> INTO my_record * FROM my_table FOR UPDATE WHERE ..., but apparently
> plpgsql doesn't like the FOR UPDATE in a stored procedure.

the docs seem to imply that the FOR UPDATE clause should follow the
WHERE clause.
and indeed, it would seem that your should follow the '*'
try
SELECT * INTO my_record WHERE ... FOR UPDATE

gnari

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2004-12-15 13:14:56 Re: pgplsql SELECT INTO ... FOR UPDATE
Previous Message Daniel Martini 2004-12-15 10:45:01 Re: Connect to Postgres 7.4 via ODBC