Skip to main content

COPY FROM LOCAL Error: Throw syntax error at or near LOCAL

  • April 28, 2015
  • 1 reply
  • 9 views

BRoy

I'm executing a COPY FROM LOCAL comand from client (REHL) and encounter error:

 

ERROR: syntax error at or near "local" at character 771

 

My Copy comand as below: 

/home/ODBC/vertica/bin/vsql --host=host IP --port=port number --dbname=database name --username=dbusername --password=password -c "copy schemaname.tablename(col1, col2, col3) from local '/temp/datafile.txt' DELIMITER E'|' record terminator '<ER>' direct ENFORCELENGTH NO ESCAPE;"

 

please advise what coulld be possible reason of the error and its resolution.

 

please note that, same COPY command works fine when used with FROM STDIN as well as COPY FROM '/dbserver_temp/datafile.txt'; where '/dbserver_temp/datafile.txt' is located in database server node.

 

will truly appreciate any advise on this

 

1 reply

SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • May 15, 2015

Hi,

 

   Please try using the following syntax to load the data into database using COPY FROM LOCAL. I tested in my environment and was able to load successfully.

 

[dbadmin@sanumula2 ~]$ /opt/vertica/bin/vsql --host=hostname --port=portnumber--dbname=database name --username=dbusername --password= password -c "COPY public. test1 FROM LOCAL 'testfile.txt' DELIMITER E'|' record terminator '<ER>' direct ENFORCELENGTH NO ESCAPE;"
Rows Loaded
-------------
4
(1 row)

 

 

There is no need to specify the column list while specifying the table name.

 

-Regards,

 Sruthi