Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPSvN-0002B6-Ce for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2020 16:01:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kPSvM-0002QZ-B0 for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2020 16:01:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPSvM-0002QS-3E for pgsql-general@lists.postgresql.org; Mon, 05 Oct 2020 16:01:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPSvK-0005sv-2a for pgsql-general@postgresql.org; Mon, 05 Oct 2020 16:01:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 095G180M1732343; Mon, 5 Oct 2020 12:01:08 -0400 From: Tom Lane To: Adrian Klaver cc: Mark , pgsql-general@postgresql.org Subject: Re: How to execute the sql file in PSQL In-reply-to: References: Comments: In-reply-to Adrian Klaver message dated "Mon, 05 Oct 2020 08:33:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1732341.1601913668.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 05 Oct 2020 12:01:08 -0400 Message-ID: <1732342.1601913668@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Adrian Klaver 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