Re: [PATCH] COPY vs \copy HINT - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] COPY vs \copy HINT
Date
Msg-id 5985.1473003235@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] COPY vs \copy HINT  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] COPY vs \copy HINT
List pgsql-hackers
I wrote:
> Craig Ringer <craig@2ndquadrant.com> writes:
>> I thought about that but figured it didn't really matter too much,
>> when thinking about examples like
>> # COPY batch_demo FROM '/root/secret.csv' WITH (FORMAT CSV);
>> ERROR:  could not open file "/root/secret.csv" for reading: Permission denied
>> or whatever, where the user doesn't understand why they can't read the
>> file given that their local client has permission to do so.

> Meh.  Hinting in this case could be helpful only if the user in fact had
> identical directory structures on client and server and a data file in the
> right place on both.

So my consciousness was raised just now by an example of exactly this
scenario over in pgsql-novice.  What I forgot was that the client may
in fact be on the same machine as the server, in which case EACCES
is pretty much exactly what you'd expect.  So we probably do want to
hint for that case, but the hint wording I previously suggested no
longer seems like le mot juste ... it needs to cover the idea that
the client and server are different processes on the same machine.

I don't suppose there's any easy way for COPY to distinguish local
from remote connections --- if it could, that might influence both
the errnos to hint for and the phrasing of the hint.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Add support for restrictive RLS policies
Next
From: Stephen Frost
Date:
Subject: Re: Remove superuser() checks from pgstattuple