Re: update several columns from function returning several values - Mailing list pgsql-general

From Tom Lane
Subject Re: update several columns from function returning several values
Date
Msg-id 4864.1417541017@sss.pgh.pa.us
Whole thread Raw
In response to update several columns from function returning several values  (Rémi Cura <remi.cura@gmail.com>)
Responses Re: update several columns from function returning several values
List pgsql-general
=?UTF-8?Q?R=C3=A9mi_Cura?= <remi.cura@gmail.com> writes:
> IF I define a function returning several values , I can't use it to update
> mutliple columns of a table at once.
> ...
> UPDATE test_update_m_values SET (gid_plus_1,gid_minus_1) =
> (rc_test_update_m_values(gid)); --doesn't work

> Somebody now if this is possible?

Not currently.  In 9.5 it'll be possible to do

UPDATE test_update_m_values SET (gid_plus_1,gid_minus_1) =
(select * from rc_test_update_m_values(gid));

but the syntax you were trying will never work, because it would be
ambiguous with the case of assigning a composite value to a single
composite column.

            regards, tom lane


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Programmatic access to interval units
Next
From: Merlin Moncure
Date:
Subject: Re: Programmatic access to interval units