unable run \copy command via PGconn.( exec || query )

  • Thread starter Ashikali Ashikali
  • Start date
A

Ashikali Ashikali

Hi ,
I am facing problem while executing following code :

require 'postgres'
obj = PGconn.new( '192.168.1.156',5432 ,'','','tikono','tikono','tikono'
)
a = "\\COPY
ivr_interface.call_flow(ref_id,loaded_time,menuid,expected_dtmf,expected_dtmf_status,processing_input,confirmation,external_staus,external_value)
from ./backupFiles/ivr_interface.call_flow.new WITH DELIMITER '$' NULL
'nil'"
p a
obj.exec( a )
p obj.methods

Error :
query.rb:5:in `exec': ERROR: syntax error at or near "\" at character 1
(PGError)
from query.rb:5
X=============================X

If I use "\copy ..." , Instead of "\\copy" then I got
query.rb:3: Invalid escape character syntax
a = "\COPY
ivr_interface.call_flow(ref_id,loaded_time,menuid,expected_dtmf,expected_dtmf_status,processing_input,confirmation,external_staus,external_value)
from ./backupFiles/ivr_interface.call_flow.new WITH DELIMITER '$' NULL
'nil'"

Note : Not PGERROR


If I use ,
'\COPY
ivr_interface.call_flow(ref_id,loaded_time,menuid,expected_dtmf,expected_dtmf_status,processing_input,confirmation,external_staus,external_value)
from ./backupFiles/ivr_interface.call_flow.new WITH DELIMITER \'$\'
NULL \'nil\''

I got the Error as ,
query.rb:5:in `exec': ERROR: syntax error at or near "\" at character 1
(PGError)
from query.rb:5

Can anyone tell me How to escape this \copy in PGconn.( query|| exec )
method ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top