Re: file_fdw vs relative paths
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: Magnus Hagander <magnus@hagander.net>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2020-08-25T00:26:12Z
Lists: pgsql-hackers
Attachments
- file.diff (text/x-diff) patch
On Wed, Jul 15, 2020 at 01:22:21PM +0200, Magnus Hagander wrote: > According to the documentation, the filename given in file_fdw must be an > absolute path. Hwever, it works perfectly fine with a relative path. > > So either the documentation is wrong, or the code is wrong. It behaves the same > at least back to 9.5, I did not try it further back than that. Yes, I tested back to 9.5 too: CREATE EXTENSION file_fdw; CREATE SERVER pgconf FOREIGN DATA WRAPPER file_fdw; CREATE FOREIGN TABLE pgconf (line TEXT) SERVER pgconf OPTIONS ( filename 'postgresql.conf', format 'text', delimiter E'\x7f' ); SELECT * FROM pgconf; # ----------------------------- # PostgreSQL configuration file # ----------------------------- # # This file consists of lines of the form: ... > I can't find a reference to the code that limits this. AFAICT the documentation > has been there since day 1. > > Question is, which one is right. Is there a reason we'd want to restrict it to > absolute pathnames? I think it should work just like COPY, which allows relative paths; doc patch attached. -- Bruce Momjian <bruce@momjian.us> https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee
Commits
-
Change path in example of file_fdw for logs
- a82919afe26a 13.0 landed
- 68b603e1a934 14.0 landed
-
Fix docs bug stating file_fdw requires absolute paths
- ae6c6c255648 9.5.24 landed
- fd0f8a6c3a9e 9.6.20 landed
- 1b694b70c054 10.15 landed
- d58dea6ae028 11.10 landed
- 73952310bfcd 12.5 landed
- 3a1f6a2581e4 13.0 landed
- 3a788db60108 14.0 landed
-
Add contrib/file_fdw foreign-data wrapper for reading files via COPY.
- 7c5d0ae70784 9.1.0 cited