Re: copy command - something not found

2020-12-29 Thread Susan Hurst
Tom...I think you are right about feeding the contents of the csv file to the shell instead of psql. After drilling down a bit more into my script, I now think I have a UNIX shell script problem rather than a psql problem. I do appreciate everyone's input as it has been most helpful in my

Re: copy command - something not found

2020-12-29 Thread Adrian Klaver
On 12/29/20 12:01 PM, Susan Hurst wrote: Actually, the -c was in an example of a copy command that I found while working at my last job. I tried executing the command without the -c and got the same results as before, so I suppose I really don't know what it means. Can you enlighten me? -c

Re: copy command - something not found

2020-12-29 Thread Christophe Pettus
> On Dec 29, 2020, at 11:12, Susan Hurst 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

Re: copy command - something not found

2020-12-29 Thread Igor Korot
Hi You could try to do "set +x" before running the script... Thank you. On Tue, Dec 29, 2020, 2:23 PM David G. Johnston wrote: > On Tue, Dec 29, 2020 at 1:01 PM Susan Hurst < > susan.hu...@brookhurstdata.com> wrote: > >> Actually, the -c was in an example of a copy command that I found while

Re: copy command - something not found

2020-12-29 Thread David G. Johnston
On Tue, Dec 29, 2020 at 1:01 PM Susan Hurst wrote: > Actually, the -c was in an example of a copy command that I found while > working at my last job. I tried executing the command without the -c and > got the same results as before, so I suppose I really don't know what it > means. > > Can you

Re: copy command - something not found

2020-12-29 Thread Susan Hurst
Actually, the -c was in an example of a copy command that I found while working at my last job. I tried executing the command without the -c and got the same results as before, so I suppose I really don't know what it means. Can you enlighten me? ---

Re: copy command - something not found

2020-12-29 Thread Susan Hurst
Thank you for the reminders, John. I changed my .z file extension to .tmp and removed the trailing / from my pre-defined directory path. I'm still getting the same results as before though after changing the .z file extension to .tmp. The ${DBNAME} and ${HOSTNAME} variables are input at run

Re: copy command - something not found

2020-12-29 Thread Tom Lane
Susan Hurst writes: > ##-- output from terminal window > /home/dbzone/stp/rfc_db/RFC-1/RFC-1_copy_bar_active.csv: > schema_name,table_name,table_alias: not found > /home/dbzone/stp/rfc_db/RFC-1/RFC-1_copy_bar_active.csv: > chief,source_systems,ssys: not found >

Re: copy command - something not found

2020-12-29 Thread David G. Johnston
On Tuesday, December 29, 2020, Susan Hurst wrote: > > ##-- shell script command > psql -c < ${CSVPATH}copycmd.z > Given the meaning of ā€œ-cā€ what are you expecting that to do? David J.

Re: copy command - something not found

2020-12-29 Thread John McKown
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"

copy command - something not found

2020-12-29 Thread Susan Hurst
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.