pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mark <jxustnc@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: How to execute the sql file in PSQL
Date: Mon, 5 Oct 2020 08:33:57 -0700
Message-ID: <a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com> (raw)
In-Reply-To: <CALChJr7S1M4W6QNcA4nOD55qyO1gjoG3T2PZGB_75mBM0tuknA@mail.gmail.com>
References: <CALChJr7S1M4W6QNcA4nOD55qyO1gjoG3T2PZGB_75mBM0tuknA@mail.gmail.com>

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-d...
> 
> 
> 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





view thread (5+ messages)  latest in thread

Message-ID: <a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com>
Permalink:  ../a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com/
Also on:    postgresql.org/message-id/a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, jxustnc@gmail.com
  Subject: Re: How to execute the sql file in PSQL
  In-Reply-To: <a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com>
  References: <CALChJr7S1M4W6QNcA4nOD55qyO1gjoG3T2PZGB_75mBM0tuknA@mail.gmail.com> <a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox