Re: copy command - something not found

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: susan(dot)hurst(at)brookhurstdata(dot)com
Cc: Discuss List Postgres <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: copy command - something not found
Date: 2020-12-29 20:43:04
Message-ID: 69A238A6-FAD2-41BF-9473-C536697E0CF8@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Dec 29, 2020, at 11:12, Susan Hurst <susan(dot)hurst(at)brookhurstdata(dot)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 .csv file 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(at)thebuild(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-12-29 20:43:39 Re: copy command - something not found
Previous Message Igor Korot 2020-12-29 20:35:58 Re: copy command - something not found