Re: Fixing set-returning functions are not allowed in UPDATE afterupgrade to Postgres 12 - Mailing list pgsql-general

From David G. Johnston
Subject Re: Fixing set-returning functions are not allowed in UPDATE afterupgrade to Postgres 12
Date
Msg-id CAKFQuwbqwpPkzDWuL_ehhuYHJtn4ZqAxmGCB2oOEiL_6Aeponw@mail.gmail.com
Whole thread Raw
In response to Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
On Thu, Apr 2, 2020 at 11:38 PM Andrus <kobruleht2@hot.ee> wrote:
Hi!

>Simply replace
>   SET col = unnest(array_value)
>with
>
>   SET col = array_value[1]

I tried

 
update temprid set
    ContactFirstName =xpath(
         '/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x)[1]::text


Parens around the function call expression are required per the syntax documentation for array subscript access:


update temprid set
    ContactFirstName =(xpath(
         '/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x))[1]::text  

David J.

pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12
Next
From: Tim Cross
Date:
Subject: Re: Improve COPY performance into table with indexes.