Re: How to execute the sql file in PSQL - Mailing list pgsql-general

From Adrian Klaver
Subject Re: How to execute the sql file in PSQL
Date
Msg-id a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com
Whole thread Raw
In response to How to execute the sql file in PSQL  (Mark <jxustnc@gmail.com>)
Responses Re: How to execute the sql file in PSQL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 10/5/20 7:55 AM, Mark wrote:
> 
> 
> Stackoverflow question link: 
>
https://stackoverflow.com/questions/64210281/using-psql-executing-sql-format-file-shows-permission-denied-on-windows-platform
> 
> 
> I followed one PostgreSQL tutorial step by step. One session to use PSQL 
> to execute sql files to create a new database in PostgreSQL.
> 
>  1.   copy  paste the sql file within "C:\Program Files\PostgreSQL\12"
>     directory.
>  2.   execute the following code \i  C:\\Program
>     Files\\PostgreSQL\\12\\demo-big-en-20170815.sql 
> 
> Failed
> The message shows C:: Permission denied
> then tried  \ir  "C:\\Program 
> Files\\PostgreSQL\\12\\demo-big-en-20170815.sql"
> Failed
> The message shows unrecognized win32 error code: 123"C:/Program 
> Files/PostgreSQL/12/createdatabasesupertest.sql: Invalid argument
> 
> SQL file probably was wrong. SO I tried to create a simple sql file 
> (create a new database). Then  I follow the above mentioned step to  
> execute the file on windows PSQL.  But  it failed the same way just like 
> the above mentioned.
> 
> So basically my PSQL can not run script files.  What should i do?

The issue is the user you are running psql as does not have permissions 
to read the file. This is a OS permissions thing. Either run psql as a 
user that can read the file or change the permissions on the file to 
those that allow the psql user to read it.

> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: UUID generation problem
Next
From: "James B. Byrne"
Date:
Subject: Re: UUID generation problem