Re: ERROR: must be superuser to COPY to or from a file

From: Kamchybek Jusupov <kjusupov(at)gmail(dot)com>
To: "Jorge Alberto" <csnmgeek(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ERROR: must be superuser to COPY to or from a file
Date: 2007-09-28 20:04:36
Message-ID: A50E9AA0-F494-4BA4-87FB-9A82A8C6BEA1@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

there is more than a way to skin a cat...

CREATE TABLE table1 (
code char(5),
name char(10)
);

synack(at)deimos db $ cat /tmp/tt.txt
1,kamchi
2,mahabat
3,kamila

postgres(at)deimos ~ $ cat /tmp/tt.txt | psql -h localhost -d tt -c "copy
table1 from stdin delimiter ',';"

postgres(at)deimos ~ $ psql -d tt -c "select * from table1;"
code | name
-------+------------
1 | kamchi
2 | mahabat
3 | kamila
(3 rows)

Rgds,

Kamchybek Jusupov
kjusupov(at)gmail(dot)com

On Sep 29, 07, at 3:40 AM, Jorge Alberto wrote:

> Hello
> I want to fill in a table from a file, but when I use the COPY
> command I get the following error:
>
> mydb=> COPY weather FROM '/home/fideito/weather.txt';
> ERROR: must be superuser to COPY to or from a file
> HINT: Anyone can COPY to stdout or from stdin. psql's \copy
> command also works for anyone.
>
> But, what can I do if I'm not root?
>
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Richard Broersma Jr 2007-09-28 20:05:57 Re: Why is my view ddl being altered by postgres?
Previous Message Sean Davis 2007-09-28 19:58:03 Re: ERROR: must be superuser to COPY to or from a file