Re: copy command - something not found - Mailing list pgsql-general

From Christophe Pettus
Subject Re: copy command - something not found
Date
Msg-id 69A238A6-FAD2-41BF-9473-C536697E0CF8@thebuild.com
Whole thread Raw
In response to copy command - something not found  (Susan Hurst <susan.hurst@brookhurstdata.com>)
List pgsql-general

> On Dec 29, 2020, at 11:12, Susan Hurst <susan.hurst@brookhurstdata.com> wrote:
>
> ##-- shell script command
> psql -d ${DBNAME} -U ${DBNAME} -h ${HOSTNAME} -c < ${CSVPATH}copycmd.z

The -c argument there specifies a command to run, so it needs an argument of some kind.  It looks like ultimately the
.csvfile gets handed to the shell to execute, which of course doesn't work very well. 

The file ${CSVPATH}copycmd.z contains the COPY command to run, yes?

The -i argument specifies a file that contains a command to run, so you might give this a go:

    psql -d ${DBNAME} -U ${DBNAME} -h ${HOSTNAME} -i "${CSVPATH}copycmd.z"
--
-- Christophe Pettus
   xof@thebuild.com




pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Re: copy command - something not found
Next
From: Adrian Klaver
Date:
Subject: Re: copy command - something not found