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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, 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-03 07:17:55
Message-ID: CAKFQuwbqwpPkzDWuL_ehhuYHJtn4ZqAxmGCB2oOEiL_6Aeponw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 2, 2020 at 11:38 PM Andrus <kobruleht2(at)hot(dot)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:

https://www.postgresql.org/docs/current/sql-expressions.html#SQL-EXPRESSIONS-SUBSCRIPTS

update temprid set
ContactFirstName =(xpath(

'/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x)
)[1]::text

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-04-03 07:25:50 Re: Help to find-the-maximum-length-of-field-in-a-particular-column-in-all the tables
Previous Message Andrus 2020-04-03 06:37:39 Re: Fixing set-returning functions are not allowed in UPDATE after upgrade to Postgres 12