Pg_read_file 没有这样的文件或目录错误?

Pg_read_file no such file or directory error?

CREATE OR REPLACE FUNCTION j_f_sync_from_xml()
RETURNS boolean AS
$BODY$
DECLARE
myxml    xml;
datafile text := 'ABBATE_EMANUELE.xml';
BEGIN

myxml := pg_read_file(datafile, 0, 100000000); 

CREATE TABLE james AS
SELECT (xpath('//some_id/text()', x))[1]::text AS id
FROM   unnest(xpath('/xml/path/to/datum', myxml)) x;
END;
$BODY$ language plpgsql;

目录是C:\Program Files\PostgreSQL.4\data,我在路径中插入文件'ABBATE_EMANUELE.xml'。我尝试使用其他文件,但它不起作用。

无法重现。

检查目录:

postgres=# show data_directory;
 data_directory
----------------
 /pg/d10
(1 row)

现在正在创建文件并读取它:

postgres=# \! echo $(date) > /pg/d10/test

postgres=# do $$ declare c text; df text := 'test';
begin
c := pg_read_file(df);
raise info '%', c;
end;
$$
;
INFO:  Tue Nov 28 09:59:30 UTC 2017