This seems like a weird design choice. Why would you need to load a file from the file system as part of a select?
Unless I'm missing some kind of use case this seems like a bad protocol design.
Unless I'm missing some kind of use case this seems like a bad protocol design.
COPY with a file name instructs the PostgreSQL server to directly read from or
write to a file. The file must be accessible by the PostgreSQL user (the user
ID the server runs as) and the name must be specified from the viewpoint of the
server.
Clients using COPY, including psql’s \copy, often pass STDIN or STDOUT as the “file”, which allows data to be transmitted over the wire rather from the server’s filesystem.PostgreSQL COPY can read or write to server files, though it requires superuser permissions.
There is also COPY FROM/TO STDIN/STDOUT, which allows the client to send the files on the same connection.