help request

Started by Hasan Mokhtari Sangchiabout 25 years ago4 messagesgeneral
Jump to latest
#1Hasan Mokhtari Sangchi
mokhtari@hadid.sharif.ac.ir

hello dear.
I want to run the following command
" copy table1 form /tmp/table1.aa using delimiters '|';
but I cant because I am not 'postgres' user and have not this privilage;
If I use follawing command instead:
" \copy table1 form /tmp/table1.aa using delimiters '|';
psql report follawing error :
"extra token after file name "
what I can do?
thanks a lot;

#2Zak McGregor
zak@mighty.co.za
In reply to: Hasan Mokhtari Sangchi (#1)
Re: help request

On Mon, 26 Mar 2001 18:44:59 +0430
"Hasan Mokhtari" <mokhtari@hadid.sharif.ac.ir> wrote:

hello dear.
I want to run the following command
" copy table1 form /tmp/table1.aa using delimiters '|';
but I cant because I am not 'postgres' user and have not this privilage;
If I use follawing command instead:
" \copy table1 form /tmp/table1.aa using delimiters '|';
psql report follawing error :
"extra token after file name "
what I can do?
thanks a lot;

Perhaps you should quote the filename thus:
\copy table1 from '/tmp/table1.aa' using delimiters '|';

HTH

ciao

Zak

#3Oliver Elphick
olly@lfix.co.uk
In reply to: Hasan Mokhtari Sangchi (#1)
Re: help request

"Hasan Mokhtari" wrote:

I want to run the following command
" copy table1 form /tmp/table1.aa using delimiters '|';
but I cant because I am not 'postgres' user and have not this privilage;

The issue is what the postgres backend can read; the filename given
must be readable by postgres; you can achieve this by the following
Unix command:

chmod a+r /tmp/table1.aa

Then you can use the copy command as above (except that the filename must
be in single quotes):

COPY table1 FROM '/tmp/table1.aa' USING DELIMITERS '|';

If I use follawing command instead:
" \copy table1 form /tmp/table1.aa using delimiters '|';
psql report follawing error :
"extra token after file name "

\copy does not support "using delimiters"

what I can do?

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Cast all your anxiety on him, because he cares for
you." I Peter 5:7

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hasan Mokhtari Sangchi (#1)
Re: help request

"Hasan Mokhtari" <mokhtari@hadid.sharif.ac.ir> writes:

If I use follawing command instead:
" \copy table1 form /tmp/table1.aa using delimiters '|';
psql report follawing error :
"extra token after file name "
what I can do?

Leave out the semicolon (';') at the end. In general, psql's backslash
commands do not use a terminating semicolon --- they just end at the
end of the line.

Also, if you are using a version before 7.0, you may need to update.
I don't think psql supported "using delimiters" in \copy before 7.0.

regards, tom lane