Re: Unable to execute \copy from Client Application

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Unable to execute \copy from Client Application
Date: 2012-02-16 16:55:04
Message-ID: 4F3D34E8.9070900@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/16/12 1:05 AM, sujayr06 wrote:
> Please find the usage of \copy and the corresponding API.
>
> strPgSqlQuerybuf<<"\\copy hnb_registration FROM
> '/root/Sujay/hnbfile.txt' USING DELIMITERS ','";

The \ commands are all metacommands for the PSQL utility, none of it is
SQL that can be sent as a query.

you need to use the plain sql 'COPY ... FROM STDIN' command, and use
PQputCopyData() to send the data (eg, read your /root/Sujay/hnbfile.txt
and send it to that API).

ugh, /root ?!? Why is ROOT running *ANY* SQL at all ??

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2012-02-16 19:18:34 How to recover data from cluster
Previous Message sodik 2012-02-16 16:53:14 Check if backup is in progress