Re: Script Location - Mailing list pgsql-general

From Lamar Owen
Subject Re: Script Location
Date
Msg-id 3A13660E.899E628F@wgcr.org
Whole thread Raw
In response to Script Location  (Paul M Foster <paulf@quillandmouse.com>)
List pgsql-general
Paul M Foster wrote:
>
> When I dump a database (creating a script from the pg_dump command), I
> can't just put it in any old directory and point psql at it. I have to
> put it in the /var/lib/pgsql subdirs before postgresql will accept it.
> Is this right? Am I doing something wrong? Is this a bug^H^H^Hfeature?

You just have to point the output of pg_dump to any directory owned by
the user running pg_dump.

Since you mention /var/lib/pgsql, I'm assuming you are using an RPM
installation.  If my assumption is incorrect, correct me, please.

In the default RPM installation, /var/lib/pgsql serves multiple roles:
/var/lib/pgsql is ~postgres
/var/lib/pgsql/data is PGDATA
/var/lib/pgsql/backups is designed as a repository for your dumps.  This
gives you a 'safe haven' for your dumps that is owned by the user
postgres, which is the default database administration user for the RPM
installation.

If you attempt to pg_dump to a file in a directory not owned by
postgres, you will get an error. Likewise, if you have a dumpfile from
another system in a directory where the user postgres (or whatever user
you are trying to pipe the dump through psql back in) doesn't have read
and execute permissions, you will get an error.

To correct this problem, set your permissions appropriately in the
directory you wish to use.

Hope that helps!
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

pgsql-general by date:

Previous
From: GH
Date:
Subject: Re: Script Location
Next
From: "Denis A. Doroshenko"
Date:
Subject: Re: no history in psql on OpenBSD