升级到Postgres 12语句后
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
抛出错误
更新中不允许使用返回集合的功能
如何解决?在Postgres 9.1中有效。我在这里阅读了类似的答案,但他们建议完全覆盖声明。也许仅仅是改变使该语句起作用?
如果xpath返回多个值,则结果应为xpath表达式的任何值
更新
我根据回答尝试过
update temprid set
ContactFirstName =xpath(
'/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x)[1]::text
但是有错误
ERROR: syntax error at or near "["
LINE 3: .../BuyerParty/ContactData/ContactFirstName/text()',x)[1]::text
简单替换