我正在尝试从 PostgreSQL 表 events_data 中获取一些数据
Table public.incidents_data
Column | Type | Modifiers | Storage | Stats target | Description
-----------+-------------------------+-----------+----------+--------------+-------------
mib_name | character varying(64) | | extended | |
timestamp | bigint | not null | plain | |
node_id | bigint | not null | plain | |
id | bigint | not null | plain | |
xml_data | character varying(4096) | | extended | |
cause | character varying(128) | | extended | |
数据位于 xml_data 列中,具有以下 XML 布局。
<Incident>
<ExtraInformation>
<SslState>error</SslState>
<RemoteLocalTuple>Remote Ip:Port 1.1.1.1:46537 <---> Local Ip:Port 2.2.2.2:5061</RemoteLocalTuple>
</ExtraInformation>
<StandardInfo>
<Cause>error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired</Cause>
<MIBName>ipcsTlsHandshakeFailure</MIBName>
<Timestamp>1594933477674</Timestamp>
<IncidenceId>797466738837365</IncidenceId>
<Source>source-server</Source>
</StandardInfo>
</Incident>
尝试使用 xpath 获取 RemoteLocalTuple 数据,如下所示。
select xpath('/mydefns:Incident/mydefns:ExtraInformation/mydefbs:RemoteLocalTuple', xml_data) from incidents_data where mib_name='ipcsTlsHandshakeFailure';
select xpath('//Incidents/ExtraInformation/RemoteLocalTuple/text()',xml_data) from incidents_data where mib_name='ipcsTlsHandshakeFailure';
我在 xpath 命令上遇到错误。
错误:函数 xpath(未知,字符变化)不存在
提示:没有函数与给定的名称和参数类型匹配。您可能需要添加显式类型转换。
服务器正在运行 psql (PostgreSQL) 9.4.21 并且 libxml2 库已安装在服务器上。
我使用 xpath 函数的方式是否错误?
我试图在 jaspersoft 中使用我的函数,但它给了我以下错误: 错误:函数 getxmlvalue(未知,字符变化)不存在 提示:没有函数与给定的名称和参数类型匹配。您可能需要添加显式类型转换。 其中:PL/pgSQL函数common.repcon0001_1(字符变化)第5行在语句块局部变量初始化期间
这是我的功能:
**选择 common.drop_function('common.repcon0001_1');
创建或替换函数 common.repcon0001_1(sxmlrecords varchar) 返回表 ( srif localref.person.srif%type, snumber
localref.realproperty.snumber%类型, 名字文本, 姓氏文本, naliquot localref.realproperty.naliquot%type) AS $body$ <> 声明 -- nrealpropertyid localref.realproperty.nrealpropertyid%type := getxmlvalue('nrealpropertyid', sxmlrecords); ncondoid localref.person.npersonid%type := getxmlvalue('npersonid', sxmlrecords); - 开始 -- 返回查询 -- 选择 PERS.SRIF, R.SNUMBER, PERS.SFIRSTNAME || ' ' || PERS.姓氏,' ', 纳利夸 来自 RealProperty R 加入人员 ON R.NHOMEOWNERID = PERS.NPERSONID,其中 PERS.NPERSONID >= 0; - 结尾; $body$ 语言 plpgsql 不可变;**
如何解决此错误?我不明白是什么问题,谢谢!!