import .sql file into PostgreSQL database

Started by Gaurav Jindalabout 12 years ago7 messagesgeneral
Jump to latest
#1Gaurav Jindal
gaurjin@gmail.com

How to import the .sql file using PSQL or PgAdmin? Can anyone guide me with
details and step by step instructions.

I tried \i filename.sql command but permission denied. I don't know how to
make it work. Can anyone helps me out. Thanks!

Gaurav

#2Michael Paquier
michael@paquier.xyz
In reply to: Gaurav Jindal (#1)
Re: import .sql file into PostgreSQL database

On Tue, Apr 8, 2014 at 12:33 PM, Gaurav Jindal <gaurjin@gmail.com> wrote:

How to import the .sql file using PSQL or PgAdmin? Can anyone guide me with
details and step by step instructions.

I tried \i filename.sql command but permission denied. I don't know how to
make it work. Can anyone helps me out. Thanks!

As you mentionned "¥i $FILE" (as is psql -f $FILE) is just fine, as
you are getting a permission error just be sure that the user that is
using the client application has a read access to the sql file you are
trying to use.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In reply to: Michael Paquier (#2)
Re: import .sql file into PostgreSQL database

On 08/04/2014 04:47, Michael Paquier wrote:

On Tue, Apr 8, 2014 at 12:33 PM, Gaurav Jindal <gaurjin@gmail.com> wrote:

How to import the .sql file using PSQL or PgAdmin? Can anyone guide me with
details and step by step instructions.

I tried \i filename.sql command but permission denied. I don't know how to
make it work. Can anyone helps me out. Thanks!

As you mentionned "�i $FILE" (as is psql -f $FILE) is just fine, as
you are getting a permission error just be sure that the user that is
using the client application has a read access to the sql file you are
trying to use.

Where is the "Permission denied" coming from? - the OS, or Postgres?

Check, in addition to the above, that the Postgres user you're using for
the connection has the requisite INSERT, SELECT (etc) permissions on the
database objects.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In reply to: Gaurav Jindal (#1)
Re: import .sql file into PostgreSQL database

On 09/04/2014 03:42, Gaurav Jindal wrote:

Inline image 1

On Tue, Apr 8, 2014 at 5:21 PM, <gaurjin@gmail.com
<mailto:gaurjin@gmail.com>> wrote:

- Your OS

Windows 7

- What version of PostgreSQL you have

9.3.4

- What is in the SQL file you're trying to execute.

Tables and their description

- The EXACT error message that you're getting.

Permission denied when I run
\i dump.sql in psql

Please keep your replies on-list.

I think that message is coming from the OS; messages from Postgres are
usual more specific, for example, "Permission denied for relation....".

It looks as if you haven't the OS permissions to read the SQL file.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Michael Paquier
michael@paquier.xyz
In reply to: Raymond O'Donnell (#4)
Re: import .sql file into PostgreSQL database

On Thu, Apr 10, 2014 at 1:02 AM, Raymond O'Donnell <rod@iol.ie> wrote:

I think that message is coming from the OS; messages from Postgres are
usual more specific, for example, "Permission denied for relation....".

It looks as if you haven't the OS permissions to read the SQL file.

On Windows, you need either to play with icacls to set some read
permissions or you can change it directly using the properties menu
findable by right-clicking on the culprit file.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#6Gaurav Jindal
gaurjin@gmail.com
In reply to: Michael Paquier (#5)
Re: [GENERAL] import .sql file into PostgreSQL database

Just going thru old emails and came across this one. Thought to text you.
How have you been? What are you up to? How can I rejoin this group?

Gaurav

On Wed, Apr 9, 2014 at 7:32 PM Michael Paquier <michael.paquier@gmail.com>
wrote:

Show quoted text

On Thu, Apr 10, 2014 at 1:02 AM, Raymond O'Donnell <rod@iol.ie> wrote:

I think that message is coming from the OS; messages from Postgres are
usual more specific, for example, "Permission denied for relation....".

It looks as if you haven't the OS permissions to read the SQL file.

On Windows, you need either to play with icacls to set some read
permissions or you can change it directly using the properties menu
findable by right-clicking on the culprit file.
--
Michael

#7Michael Paquier
michael@paquier.xyz
In reply to: Gaurav Jindal (#6)
Re: [GENERAL] import .sql file into PostgreSQL database

On Thu, May 07, 2020 at 11:46:02PM -0400, Gaurav wrote:

Just going thru old emails and came across this one. Thought to text you.
How have you been? What are you up to? How can I rejoin this group?

Fine thanks. In order to subscribe to one or more mailing lists,
please feel free to look here:
https://lists.postgresql.org/
--
Michael