Search Postgresql Archives

Re: SQL function and "UPDATE...RETURNING"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/2/07, Vincenzo Romano <vincenzo.romano@xxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux