Re: update several columns from function returning several values

From: Rémi Cura <remi(dot)cura(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: update several columns from function returning several values
Date: 2014-12-03 15:42:59
Message-ID: CAJvUf_vHVb9RFM5On-1TUvd1hEqQXG=y6d_gg6PA3TCbvB1HFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks,
waiting for the 9.5 then =)
Cheers,
Rémi-C

2014-12-02 18:23 GMT+01:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> =?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

Browse pgsql-general by date

  From Date Subject
Next Message pinker 2014-12-03 15:52:20 Mistake in documentation? ANALYZE on partitioned tables
Previous Message Tim Schäfer 2014-12-03 15:39:47 Re: Auto vacuum not running -- Could not bind socket for statistics collector