SQL function and "UPDATE...RETURNING"

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SQL function and "UPDATE...RETURNING"
Date: 2007-08-02 15:30:05
Message-ID: 200708021730.05351.vincenzo.romano@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all.

Is there a way to write an SQL function like this:

create or replace function afunction( recid bigint )
returns bigint as $body$
update atable set afield=0 where recid=$1 returning anotherfield;
$body$ language SQL;

If i write the function this way, postgres will complain that
the update stetement won't return values.

I also understand that by switching to PLPGSQL I would b able to
do write the function. But I'd prefer SQL in this case.

--
Vincenzo Romano
--
Maybe Computer will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrei Kovalevski 2007-08-02 15:47:50 Re: pgTray - win32 tray tool for monitoring PostgreSQL service
Previous Message Tony Caduto 2007-08-02 14:48:53 Re: pgTray - win32 tray tool for monitoring PostgreSQL service