![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I want to automate a task to copy values to a table. The shell script is this (simple form): psql -U postgres -d sedait_db -c ' COPY dp_calc_temp ( ano ) FROM \'/usr/local/pgsql/home/dw/iva_dp/calculados/ dp_calculados_juntos.csv\' WITH CSV ; ' The problem is that I have to use ' to delimit the entire psql command, but ' is also required to for the file reference. I tried to escape ' with \', as in the example, but I get as a response: unexpected EOF while liiking for matching `'' syntax error: unexpected end of file If I try no \ escaping, I get a syntax error near "/" Also tried do use double ', but to no avail. I even tried $/usr/...$, but didn't make it. How can this be solved? Luis Hi, |
#3
| |||
| |||
|
|
On 2007-09-05, luisl... (AT) gmail (DOT) com <luisl... (AT) gmail (DOT) com> wrote: Hi, I want to automate a task to copy values to a table. The shell script is this (simple form): psql -U postgres -d sedait_db -c ' COPY dp_calc_temp ( ano ) FROM \'/usr/local/pgsql/home/dw/iva_dp/calculados/ dp_calculados_juntos.csv\' WITH CSV ; ' The problem is that I have to use ' to delimit the entire psql command, but ' is also required to for the file reference. I tried to escape ' with \', as in the example, but I get as a response: unexpected EOF while liiking for matching `'' syntax error: unexpected end of file If I try no \ escaping, I get a syntax error near "/" Also tried do use double ', but to no avail. I even tried $/usr/...$, but didn't make it. How can this be solved? Luis Hi, write your script in file and then psql .... -f file rgds, d. |
#4
| |||
| |||
|
|
I want to automate a task to copy values to a table. The shell script is this (simple form): psql -U postgres -d sedait_db -c ' COPY dp_calc_temp ( ano ) FROM \'/usr/local/pgsql/home/dw/iva_dp/calculados/ dp_calculados_juntos.csv\' WITH CSV ; ' The problem is that I have to use ' to delimit the entire psql command, but ' is also required to for the file reference. I tried to escape ' with \', as in the example, but I get as a response: unexpected EOF while liiking for matching `'' syntax error: unexpected end of file If I try no \ escaping, I get a syntax error near "/" Also tried do use double ', but to no avail. I even tried $/usr/...$, but didn't make it. |
#5
| |||
| |||
|
|
I tried to escape ' with \', as in the example, but I get as a response: unexpected EOF while liiking for matching `'' syntax error: unexpected end of file |
![]() |
| Thread Tools | |
| Display Modes | |
| |