Re: [PATCH] COPY vs \copy HINT
От | Craig Ringer |
---|---|
Тема | Re: [PATCH] COPY vs \copy HINT |
Дата | |
Msg-id | CAMsr+YHP=hTUKpuHK4LOAmWE_JEe-A281QL0uni_gw-V7jQv2w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] COPY vs \copy HINT (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [PATCH] COPY vs \copy HINT
Re: [PATCH] COPY vs \copy HINT |
Список | pgsql-hackers |
On 4 September 2016 at 23:33, Tom Lane <tgl@sss.pgh.pa.us> wrote: > 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. Yep. Also in cases with common paths, like /root or whatever. > 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. Yeah, may be. *We* know that in this case "client" and "server" still applies since client and server can be on the same host, but the people who needs this hint may not understand that. Though there's only so much we can do or should try to do in a HINT. I think the most important bit is pointing them at \copy, so it's still useful. To cover the same-host case we could try something like: COPY runs on the PostgreSQL server, using the PostgreSQL server's directories and permissions, it doesn't run on the client. ... but I think that's actually less helpful for the users who'll need this. We could say "COPY runs as the PostgreSQL server" but that's the kind of hint that mostly helps people who already understand it and don't actually the hint. (BTW, whoever came up with "EACCES" needs to go spend time with the creat() system call somewhere dark and smelly). > I don't suppose there's any easy way for COPY to distinguish local > from remote connections Not that I see, since "local" can be unix socket or tcp to localhost. Not cleanly anyway. I don't think it matters. Many hosts have enough paths in common that in practice the hint on EACCES will be useful anyway. It'd be nice to work in something about running with the permissions of the PostgreSQL server, but I don't see a way to do that without making it all more complex. I don't think it's worth tons of time anyway. This will be better than what we have, lets do it. I'm fairly happy with the wording you came up with: "COPY copies to a file on the PostgreSQL server, not on the client. " "You may want a client-side facility such as psql's \\copy." and am inclined to suggest going ahead with the existing wording. I agree that removing the part for "relative path not allowed for COPY to file" is reasonable, so I've attached an update that does so and warns on EACCES too. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: