通用文件访问函数提供了对数据库服务器上的文件的本地访问接口。只有openGauss目录和log_directory目录里面的文件可以访问。使用相对路径访问openGauss目录里面的文件,以及匹配log_directory配置而设置的路径访问日志文件。只有数据库初始化用户才能使用这些函数。
pg_stat_file(filename text)
描述:返回一个文本文件的状态信息。
返回值类型:record
备注:pg_stat_file返回一条记录,其中包含:文件大小、最后访问时间戳、最后更改时间戳、最后文件状态修改时间戳以及标识传入参数是否为目录的Boolean值。典型的用法:
openGauss=# SELECT * FROM pg_stat_file('filename');openGauss=# SELECT (pg_stat_file('filename')).modification;示例:
openGauss=# SELECT convert_from(pg_read_binary_file('postmaster.pid'), 'UTF8'); convert_from -------------------------------------- 4881 + /srv/BigData/gaussdb/data1/dbnode+ 1496308688 + 25108 + /opt/user/Bigdata/gaussdb/gaussdb_tmp + * + 25108001 43352069 + (1 row)openGauss=# SELECT * FROM pg_stat_file('postmaster.pid'); size | access | modification | change | creation | isdir ------+------------------------+------------------------+------------------------ +----------+------- 117 | 2017-06-05 11:06:34+08 | 2017-06-01 17:18:08+08 | 2017-06-01 17:18:08+08 | | f (1 row)openGauss=# SELECT (pg_stat_file('postmaster.pid')).modification; modification ------------------------ 2017-06-01 17:18:08+08 (1 row)
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




