gpt4 book ai didi

postgresql - 在 postgres 中提取 xpath

转载 作者:行者123 更新时间:2023-11-29 12:51:38 26 4
gpt4 key购买 nike

有一个提取 xml 的 postgres 查询,无法正确提供 xpath

select column1, xmlcolumn from tabla 

xmlcolumn 属于以下类型:

<tag1>
<tag2>
<tag3>test</tag3>
</tag2>
</tag1>

我需要提取 tag3 的值

知道如何做到这一点吗?

最佳答案

demo: db<>fiddle

SELECT xpath('/tag1/tag2/tag3/text()', xmlcolumn) 

Postgres XML documentation

关于postgresql - 在 postgres 中提取 xpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52648782/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com