Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12
Date: 2020-04-02 14:57:48
Message-ID: f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2020-04-02 at 17:48 +0300, Andrus wrote:
> After upgrading to Postgres 12 statement
>
> update temprid set
> ContactFirstName =unnest(xpath(
> '/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x))::text,
> yhik =unnest(xpath(
> '/E-Document/Document/DocumentItem/ItemEntry/BaseUnit/text()',x))::text
> from t
>
> throws error
>
> set-returning functions are not allowed in UPDATE
>
> How to fix this ?

Simply replace

SET col = unnest(array_value)

with

SET col = array_value[1]

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abraham, Danny 2020-04-02 15:06:03 too many clients already
Previous Message Andrus 2020-04-02 14:48:59 Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12