Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA15187; Mon, 11 Nov 91 22:33:45 -0800
Message-Id: <9111120633.AA15187@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: LIBPQ -PQputline
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
In-Reply-To: Your message of "Sat, 09 Nov 91 08:15:08 PST."
             <9111091615.AA17610@postgres.Berkeley.EDU> 
Date: Mon, 11 Nov 91 22:33:35 PST

In message <9111091615.AA17610@postgres.Berkeley.EDU> you write:
> 
> I've been trying to get the following LIBPQ program to insert
> information into a database, however I get the following error
> messsage. 
> 
> FATAL 1:Nov  9 11:04:51:Socket command type c unknown
> 
> Error: No response from the backend, exiting...
> ____
> 
> I know I must be doing something wrong - but I don't know what. However  I
> have been able to get the LIBPQ extraction program from the ref man to work.
> 
> 
>      PQexec("begin");

>      PQexec("create foo (a =int4,b=char16,d=float8)");     
>      PQputline("copy foo from stdin");
>      PQputline("4	hello world	4.5");
>      PQputline(".\n");
>      PQendcopy();

>      PQexec("end");

There are two things wrong in this code excerpt. First:

      PQputline("4	hello world	4.5");

should be:

      PQputline("4	hello world	4.5\n");

A similar example is given in the libpq documentation and the \n is left
out in that example as well. The second problem is that:

      PQputline("copy foo from stdin");

should be:

      PQexec("copy foo from stdin");


Jeff Meredith
mer@postgres.berkeley.edu
