数据仓库服务 GAUSSDB(DWS)-通用文件访问函数:pg_read_file(filename text, offset bigint, length bigint)

时间:2024-05-09 09:29:49

pg_read_file(filename text, offset bigint, length bigint)

描述:返回一个文本文件的内容。

返回值类型:text

备注:pg_read_file返回一个文本文件的一部分,从offset开始,最多返回length字节(如果先达到文件结尾,则小于这个数值)。如果offset是负数,则它是相对于文件结尾回退的长度。如果省略了offset和length,则返回整个文件。

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SELECT pg_read_file('postmaster.pid',0,100);
             pg_read_file              
---------------------------------------
 53078                                +
 /srv/BigData/hadoop/data1/coordinator+
 1500022474                           +
 8000                                 +
 /var/run/dws                         +
 localhost                            +
  2
(1 row)
support.huaweicloud.com/sqlreference-830-dws/dws_06_0054.html