How to execute the sql file in PSQL

From: Mark <jxustnc(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to execute the sql file in PSQL
Date: 2020-10-05 14:55:00
Message-ID: CALChJr7S1M4W6QNcA4nOD55qyO1gjoG3T2PZGB_75mBM0tuknA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2020-10-05 14:57:22 Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0
Previous Message Tom Lane 2020-10-05 14:53:20 Re: UUID generation problem