Re: Unable to execute \copy from Client Application - Mailing list pgsql-general

From John R Pierce
Subject Re: Unable to execute \copy from Client Application
Date
Msg-id 4F3D34E8.9070900@hogranch.com
Whole thread Raw
In response to Re: Unable to execute \copy from Client Application  (sujayr06 <sujayr06@gmail.com>)
List 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


pgsql-general by date:

Previous
From: sodik
Date:
Subject: Check if backup is in progress
Next
From: "Andrus"
Date:
Subject: How to recover data from cluster