Thread: import .sql file into PostgreSQL database

import .sql file into PostgreSQL database

From
Gaurav Jindal
Date:
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

Re: import .sql file into PostgreSQL database

From
Michael Paquier
Date:
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


Re: import .sql file into PostgreSQL database

From
Raymond O'Donnell
Date:
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


Re: import .sql file into PostgreSQL database

From
Raymond O'Donnell
Date:
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


Re: import .sql file into PostgreSQL database

From
Michael Paquier
Date:
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


Re: [GENERAL] import .sql file into PostgreSQL database

From
Gaurav
Date:
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:
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

Re: [GENERAL] import .sql file into PostgreSQL database

From
Michael Paquier
Date:
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

Attachment