From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Vincenzo Romano" <vincenzo(dot)romano(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: SQL function and "UPDATE...RETURNING" |
Date: | 2007-08-02 16:59:51 |
Message-ID: | b42b73150708020959i9c73a56t7eadb63fda10dfa2@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 8/2/07, Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com> wrote:
> 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.
It's not really possible to do it that way :(
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2007-08-02 17:09:44 | Re: pgTray - win32 tray tool for monitoring PostgreSQL service |
Previous Message | Jeff Davis | 2007-08-02 16:58:33 | Re: why is the LIMIT clause slowing down this SELECT? |