pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12
Date: Thu, 02 Apr 2020 16:57:48 +0200
Message-ID: <f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at> (raw)
In-Reply-To: <B45C75638FC04DD1A56F10240E037DC4@dell2>
References: <B45C75638FC04DD1A56F10240E037DC4@dell2>

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






view thread (4+ messages)  latest in thread

Message-ID: <f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at>
Permalink:  ../f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at/
Also on:    postgresql.org/message-id/f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, kobruleht2@hot.ee
  Subject: Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12
  In-Reply-To: <f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at>
  References: <B45C75638FC04DD1A56F10240E037DC4@dell2> <f8e93dacd7bfa5c5285d13132694c3e642ae1ef7.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox