pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Mark <jxustnc@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: How to execute the sql file in PSQL
Date: Mon, 05 Oct 2020 12:01:08 -0400
Message-ID: <1732342.1601913668@sss.pgh.pa.us> (raw)
In-Reply-To: <a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com>
References: <CALChJr7S1M4W6QNcA4nOD55qyO1gjoG3T2PZGB_75mBM0tuknA@mail.gmail.com>
	<a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com>

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 10/5/20 7:55 AM, Mark wrote:
>> 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

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

... or more likely, put the SQL file in a saner place.  Dropping random
files into a program directory can only lead to trouble.  You should
treat such directories as read-only unless you know exactly what you
are doing.

It seems likely to me that this failure stems from PG being installed
with permissions settings that prevent it from reading/modifying its own
executables, which is good solid security practice.

(If the tutorial actually told you to do that, the tutorial's author
is utterly clueless.)

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <1732342.1601913668@sss.pgh.pa.us>
Permalink:  ../1732342.1601913668@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1732342.1601913668@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, jxustnc@gmail.com
  Subject: Re: How to execute the sql file in PSQL
  In-Reply-To: <1732342.1601913668@sss.pgh.pa.us>
  References: <CALChJr7S1M4W6QNcA4nOD55qyO1gjoG3T2PZGB_75mBM0tuknA@mail.gmail.com> <a48811ee-6332-2fe6-3a20-be4ce70b8bb2@aklaver.com> <1732342.1601913668@sss.pgh.pa.us>

* 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