COPY FROM in psql - Mailing list pgsql-general

From Matthew Vernon
Subject COPY FROM in psql
Date
Msg-id 87wqxgt8oo.fsf@macbeth.sac.ac.uk
Whole thread Raw
Responses Re: COPY FROM in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

suppose for a moment I want to write a psql script that loads some data
into a database. I don't want to write an absolute path into my script,
but merely know where the data file will be relative to my script
location.

naiively, you might try:
\set pwd '\'' `pwd` '\''
COPY table FROM :pwd || '/relative/path/to/data' ;

but that doesn't work because the concatenation operator can't be used
there. How should I be doing this?

Thanks,

Matthew

--
Matthew Vernon
Quantitative Veterinary Epidemiologist
Epidemiology Research Unit, SAC Inverness


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: High SYS CPU - need advise
Next
From: Matthew Vernon
Date:
Subject: Re: COPY FROM in psql