Re: update several columns from function returning several values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rémi Cura <remi(dot)cura(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: update several columns from function returning several values
Date: 2014-12-02 17:23:37
Message-ID: 4864.1417541017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?Q?R=C3=A9mi_Cura?= <remi(dot)cura(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2014-12-02 17:57:03 Re: Programmatic access to interval units
Previous Message Dave Cramer 2014-12-02 16:25:09 Fwd: [GENERAL] Trying to get SSPI/JDBC working