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 1kPSV5-0001In-Pd for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2020 15:34:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kPSV4-0000hR-Oc for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2020 15:34:06 +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 1kPSV3-0000hI-61 for pgsql-general@lists.postgresql.org; Mon, 05 Oct 2020 15:34:06 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPSUz-0005dh-0o for pgsql-general@postgresql.org; Mon, 05 Oct 2020 15:34:04 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 428395C011A; Mon, 5 Oct 2020 11:33:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 05 Oct 2020 11:33:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=O QGDFgWgihpbGn7lmht/oWZHAEyDGQejZ5rl/TAjWJw=; b=Wq4eOFkDtag7OYjwy r7BTq7/n/f2ldEUwdjKTj8f1BTd6Vsdw13hqm8u7e81bpyX9W17M2eWQeW2bh3mj X2XByVYsosgNKo0E83q7jspYjyTMvVv4LMev8CjnTF8M5bY0dcbIC1B7rTZP1K9o tE7vUf4nC9PXZ5sz+eLCXL/T5NOTenty3WagTOPlvQexEsVwaTkv4aOSkHGYRTpY SdiBJ3E8BNZGJcS/7Qpf6dm9chuxKAW1c1CSaaWRbwzcRTP75foR0tBqjMRK/oFl rtJK3gn143RRj1NxqqNexXb4IqbBCypUsGep48UkUi9PnEBADBxdqz9Q7vtVVbHf MjssQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=OQGDFgWgihpbGn7lmht/oWZHAEyDGQejZ5rl/TAjW Jw=; b=j5RjlfvMxu9ndpZekxtb4DHshc+ycrxkeyDLczmp3ySS3meJ+79Wh2RVF 2ax2zFDktqOjJfydqDHjwrjuMs64AdXTSrC7zi17MFRQCyVTFKKULE95ySo9NlVQ YDXwykSXIkI8YyQy1rdZ+BcCxy7wmXhfF3+sbCchPxRKfPXmVpCKTa2feql2xF/e VHHfWYYmEuIrMeG/805kT6hezrPxLfV+3GA/8+b3TElaz7+fQm3AJKonvYu/Xd5z xb697XkjEXm+SHZ0cyV8m8T1QVSbYc73IdJsucrpfeN0hZjeutilG7KNNIHRRlGg Y8Iv1urJWE2uuGC/ghjqSvloZdN+w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrgedvgdelvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpefhueduueetff dthfeuhfffhefhffeukeefleelledtgeevkeetvedtfffhleetveenucffohhmrghinhep shhtrggtkhhovhgvrhhflhhofidrtghomhenucfkphepjeehrddujedvrdehrddvfedune cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id A80393280065; Mon, 5 Oct 2020 11:33:57 -0400 (EDT) Subject: Re: How to execute the sql file in PSQL To: Mark , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Mon, 5 Oct 2020 08:33:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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