practical-sql icon indicating copy to clipboard operation
practical-sql copied to clipboard

"Chapter 4: COPY us_counties_2010 Permission Denied Question"

Open gobinaryn opened this issue 4 years ago • 2 comments

Having trouble with data, code, or exercises in Practical SQL? I'm glad to help. Please answer these questions, and I'll typically reply within one to two business days.

Please include the chapter number in your issue title. For example: "Chapter 13: Regular Expression Question"

General

Please answer all of these as they're essential for troubleshooting.

What's your operating system (e.g. Windows 10, macOS Catalina, Ubuntu, etc.)? WINDOWS 10

Did you install PostgreSQL and pgAdmin according to the steps on page xxviii of the book's Introduction? If not, please describe your installation. Yes and everything was smooth sailing!

Which versions of PostgreSQL and pgAdmin 4 are you using? If you aren't sure, for PostgreSQL run the SQL command SELECT version(); and for pgAdmin 4, navigate to "About pgAdmin 4" under the "Help" menu. Version 14

Did you download the book's code examples and data from GitHub using the directions on page xxvii of the Introduction? If not, please describe how you loaded the material on your computer. Yes :-)

Issue or Question

Chapter, page and code listing number: Chapter 4, pages 44-45

Describe the issue or your question: How do I fix the permission denied error for copying over a CSV? Note: I could not write to a CSV either in Chapter 3.

Please paste the code and error message here. It's OK to alter identifying info such as a folder name ERROR: could not open file "C:\Users\xxxxxx\Desktop\Practical SQL\us_counties_2010.csv" for reading: Permission denied HINT: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy. SQL state: 42501

gobinaryn avatar Oct 10 '21 13:10 gobinaryn

Hi, @gobinaryn,

On page xxvii of the Introduction (Practical SQL 1st edition), in the section "Using the Book's Code Examples," there's the following note:

After downloading data, Windows users might need to provide permission for the 
database to read files. To do so, right-click the folder containing the code and data, 
select Properties, and click the Security tab. Click Edit, then Add. Type the name 
Everyone into the object names box and click OK. Highlight Everyone in the user 
list, select all boxes under Allow, and then click Apply and OK.

Would you please check that note, make sure you've enabled those permissions, and report back? Thanks!

anthonydb avatar Oct 10 '21 15:10 anthonydb

Hi, yes that did work! Thank you!

gobinaryn avatar Oct 10 '21 17:10 gobinaryn