From: | John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com> |
---|---|
To: | susan(dot)hurst(at)brookhurstdata(dot)com, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: copy command - something not found |
Date: | 2020-12-29 19:20:43 |
Message-ID: | CAAJSdjiPGixQ5m2GCj79jKOzH-geaTZs7UO3CRQ0ZPLstb2p_Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Can't really tell. You might want to post the output of the "printenv"
command to show us what the shell variables you are using have in them.
Oh, does ${CSVPATH} end in a slash? If it is something like "~/mycsvs" then
${CSVPATH}copycmd.z will expand to "~/mycsvscopycmd.z". Most "PATH"
environment variables don't end in a /, perhaps you need
"${CSVPATH}/copycmd.z" ? Also, as an aside. most UNIX files which end in .z
are compressed, IIRC. Make sure the contents of the file are plain text.
On Tue, Dec 29, 2020 at 1:12 PM Susan Hurst <susan(dot)hurst(at)brookhurstdata(dot)com>
wrote:
> I am trying to use the copy command from a csv files using a UNIX shell
> script but something is 'not found'...I can't figure out what is 'not
> found'. Below is my command from the shell script, the executed command,
> the content of the csv file and the output from trying to execute the
> command.
>
> Clearly, the file is being read but I can't figure out what is not
> found. BTW, the column names in the stg.bar_active table match the names
> and order in the first row of the csv file. What should I be looking
> for?
>
> Thanks for your help!
>
> Sue
>
> ##-- shell script command
> psql -d ${DBNAME} -U ${DBNAME} -h ${HOSTNAME} -c < ${CSVPATH}copycmd.z
>
> ##-- executed command
> "copy stg.bar_active from
> '/home/dbzone/stp/rfc_db/RFC-00001/RFC-00001_copy_bar_active.csv'
> delimiter ',' CSV HEADER;"
>
> ##-- content of .csv file
> schema_name,table_name,table_alias ...(this is the header
> row)
> chief,source_systems,ssys
> chief,lookup_categories,lcat
> chief,lookup_data,ldat
>
> ##-- output from terminal window
> /home/dbzone/stp/rfc_db/RFC-00001/RFC-00001_copy_bar_active.csv:
> schema_name,table_name,table_alias: not found
> /home/dbzone/stp/rfc_db/RFC-00001/RFC-00001_copy_bar_active.csv:
> chief,source_systems,ssys: not found
> /home/dbzone/stp/rfc_db/RFC-00001/RFC-00001_copy_bar_active.csv:
> chief,lookup_categories,lcat: not found
> /home/dbzone/stp/rfc_db/RFC-00001/RFC-00001_copy_bar_active.csv:
> chief,lookup_data,ldat: not found
>
> ##-- select version();
> PostgreSQL 11.9 on amd64-portbld-freebsd12.1, compiled by FreeBSD clang
> version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1),
> 64-bit
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Susan E Hurst
> Principal Consultant
> Brookhurst Data LLC
> Email: susan(dot)hurst(at)brookhurstdata(dot)com
> Mobile: 314-486-3261
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2020-12-29 19:23:51 | Re: copy command - something not found |
Previous Message | Susan Hurst | 2020-12-29 19:12:47 | copy command - something not found |