Обсуждение: read in to psql from file
Hi, As I understand it, in order to read in a file containing sql commands I should use the \i <file> syntax in psql. So, from the psql prompt I type: \i /root/phones I get back "/root/phones: permission denied" I am in psql as the user who owns the database. The file in question is readable and writeable by all. What do I do next? V/R, Doug Moore
Doug Moore wrote:
>
> Hi,
>
> As I understand it, in order to read in a file containing sql commands
> I should use the \i <file> syntax in psql.
>
> So, from the psql prompt I type:
>
> \i /root/phones
>
> I get back "/root/phones: permission denied"
>
> I am in psql as the user who owns the database.
> The file in question is readable and writeable by all.
>
Is /root executable by all?
<paranoia>
You should not make a file from root accissible by grating access to
the home of root, better push the file somewhere else and "chown" the
file.
</paranoia>
With kind regards / Mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter
holger@klawitter.de http://www.klawitter.de
Doug, 1. Put the file in single quotes: \i '/root/phones' 2. Check the permissions on the directory /root/. I would suggest that the permissions for the directory /root/ be left alone and for you to move executable scripts to a different directory. Best of luck, Andrew Gould --- Doug Moore <moored3947@home.com> wrote: > Hi, > > As I understand it, in order to read in a file > containing sql commands > I should use the \i <file> syntax in psql. > > So, from the psql prompt I type: > > \i /root/phones > > I get back "/root/phones: permission denied" > > I am in psql as the user who owns the database. > The file in question is readable and writeable by > all. > > What do I do next? > > V/R, > Doug Moore > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster __________________________________________________ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
Doug Moore <moored3947@home.com> writes:
> I get back "/root/phones: permission denied"
> I am in psql as the user who owns the database.
> The file in question is readable and writeable by all.
And what about the /root directory?
regards, tom lane
--- Doug Moore <moored3947@home.com> wrote: > Hi, > > As I understand it, in order to read in a file containing sql > commands > I should use the \i <file> syntax in psql. > > So, from the psql prompt I type: > > \i /root/phones > > I get back "/root/phones: permission denied" > > I am in psql as the user who owns the database. > The file in question is readable and writeable by all. You have given rights for everyone on your machine to read/write to the /root directory? Enter the /root directory and run this (if 'phones' is the sql file): % psql -f phones Brent __________________________________________________ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/
On Mon, 17 Sep 2001, Doug Moore wrote:
> Hi,
>
> \i /root/phones
>
> I get back "/root/phones: permission denied"
Most probably you don't have access to /root. Regardless of the
permissions on a file in the directory if you can't get into the
directory you can get to the file.
I suggest you move the file to a more open location verses opening
/root up.
> I am in psql as the user who owns the database.
> The file in question is readable and writeable by all.
Cheers,
Rod
--
A small clue and no money
will get you further than
lots of money and no clue.