By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

copy command problem

P: n/a
Hi,

I am recreating a database and its applications onto a new server and
new software; old version of pg was 7.2.4 and new version is

gds2=# select version();

version

--------------------------------------------------------------------------------------------------------
PostgreSQL 7.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-20)

I am having trouble with the copy command as follows:
gds2=# copy survey_match from '/home/djisgitt/perl/fixsvy.dat' with
delimiter as '>';
ERROR: could not open file "/home/djisgitt/perl/fixsvy.dat" for
reading: Permission denied

File sysem permissions are

[djisgitt@dbserver perl]$ ls -l /home/djisgitt/perl/fixsvy.dat
-rwxrwxrwx 1 djisgitt djisgitt 198441 Nov 5 12:35
/home/djisgitt/perl/fixsvy.dat

Table definition is

gds2=# \d survey_match
Table "public.survey_match"
Column | Type | Modifiers
--------+------+-----------
oldsvy | text |
oldblk | text |
newsvy | text |
newblk | text |
First few lines of file are:

[djisgitt@dbserver perl]$ head -5 fixsvy.dat
43 >H&TC >43
OS2 >

/ E CHAPMAN >KL >TCRR
/E CHAPMAN >KL >TCRR
133 >133 >133

and in hex...

0000000 > 4 3
2020 2020 2020 2020 2020 2020 343e 2033
0000020 > H & T C
2020 2020 3e20 2648 4354 2020 2020 2020
0000040 > 4 3 \n
2020 343e 0a33 2020 2020 2020 2020 2020
0000060 > O S 2 > \n / E
2020 4f3e 3253 2020 2020 3e20 2f0a 4520
0000100 C H A P M A N > K L
4320 4148 4d50 4e41 3e20 4c4b 2020 2020
0000120 > T C R R \n / E C H A P M
2020 543e 5243 0a52 452f 4320 4148 4d50
0000140 A N > K L > T C
4e41 2020 4b3e 204c 2020 2020 3e20 4354
0000160 R R \n 1 3 3 >
5252 310a 3333 2020 2020 2020 2020 3e20
0000200 1 3 3 > 1 3 3 \n

Only two defined users are both superusers

gds2=# select * from pg_shadow;
usename | usesysid | usecreatedb | usesuper | usecatupd | passwd |
valuntil | useconfig
----------+----------+-------------+----------+-----------+--------+----------+-----------
postgres | 1 | t | t | t |
| |
djisgitt | 100 | t | t | t |
| |
(2 rows)
I tried a similar thing with a different table and input file with
identical results. What am I doing wrong? Yes, I read the copy
documentation for 7.4.

Thank you for your assistance.

Don

n.b. Implicitly stated but not declared: yes, this worked on 7.2.4 with
"with" replaced by "using" and "delimiter" replaced by "delimiters".
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Don Isgitt wrote:
Hi,

I am recreating a database and its applications onto a new server and
new software; old version of pg was 7.2.4 and new version is

gds2=# select version();

version

--------------------------------------------------------------------------------------------------------

PostgreSQL 7.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-20)

I am having trouble with the copy command as follows:
gds2=# copy survey_match from '/home/djisgitt/perl/fixsvy.dat' with
delimiter as '>';
ERROR: could not open file "/home/djisgitt/perl/fixsvy.dat" for
reading: Permission denied

File sysem permissions are

[djisgitt@dbserver perl]$ ls -l /home/djisgitt/perl/fixsvy.dat
-rwxrwxrwx 1 djisgitt djisgitt 198441 Nov 5 12:35
/home/djisgitt/perl/fixsvy.dat


Check, if your home and subdirectories has sufficient permissions: you
need at least r-x for others on the specific directories, otherwise your
backend is not able to access your dump.

chmod o+rx /home/djisgitt should do the job, i think

Bernd

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #2

P: n/a


Bernd Helmle wrote:
Don Isgitt wrote:
Hi,

gds2=# copy survey_match from '/home/djisgitt/perl/fixsvy.dat' with
delimiter as '>';
ERROR: could not open file "/home/djisgitt/perl/fixsvy.dat" for
reading: Permission denied

File sysem permissions are

[djisgitt@dbserver perl]$ ls -l /home/djisgitt/perl/fixsvy.dat
-rwxrwxrwx 1 djisgitt djisgitt 198441 Nov 5 12:35
/home/djisgitt/perl/fixsvy.dat


Check, if your home and subdirectories has sufficient permissions: you
need at least r-x for others on the specific directories, otherwise
your backend is not able to access your dump.

chmod o+rx /home/djisgitt should do the job, i think

Bernd

Thank you, Bernd; that was the problem. I obviously didn't think about
the forest, since the tree was ok. :-[
Don
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.