XML类型

openGauss支持XML类型,使用示例如下。

  1. openGauss= CREATE TABLE xmltest ( id int, data xml );
  2. openGauss= INSERT INTO xmltest VALUES (1, 'one');
  3. openGauss= INSERT INTO xmltest VALUES (2, 'two');
  4. openGauss= SELECT * FROM xmltest ORDER BY 1;
  5. id | data
  6. ----+--------------------
  7. 1 | one
  8. 2 | two
  9. (2 rows)
  10. openGauss= SELECT xmlconcat('', NULL, '');
  11. xmlconcat
  12. (1 row)
  13. openGauss= SELECT xmlconcat('', NULL, '');
  14. xmlconcat
  15. (1 row)

XML类型 - 图1 说明:

  • 该功能默认未开启,如需使用,需要重新使用build.sh脚本编译数据库,修改./configure配置参数,在其中加入—with-libxml参数。

  • 在执行编译之前,需要先执行yum install -y libxml2-devel,否则会有”configure: error: library ‘xml2’ (version >= 2.6.23) is required for XML support”的报错。

  • 在执行编译之前,需要三方库二进制文件中dependeny操作系统环境/libobs/comm/lib加入到系统环境变量LD_LIBRARY_PATH中,否则会报错”libiconv.so不存在”。