Subject: LIBPQ -PQputline

From: [email-masked]
Date: Sat, 9 Nov 91 08:15:08 -0800

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.

Also if anyone has any further information, sample programs etc
regarding the FAST PATH trap door system I would really apreciate it.

Thanks

Edwin Tait

/* test libpq.c E.Tait */

#include <stdio.h>
#include "libpq.h"
#include <string.h>

main()

     {

     /* specify the database to access */

     PQsetdb("test");
     
     /* start a transaction block for eportal */
     PQexec("begin");

     /* try to insert information into a relation */
 
     PQexec("create foo (a =int4,b=char16,d=float8)");     
     PQputline("copy foo from stdin");
     PQputline("4	hello world	4.5");
     PQputline(".\n");
     PQendcopy();
 
     /* end the transaction block */
     PQexec("end");

     /* finnish execution */
     PQfinish();
     
   }

---

From: postarch (Postgres Mailing Archive)
Date: Mon, 11 Nov 91 22:33:35 PST

>      PQexec("end");

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

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:

should be:

      PQexec("copy foo from stdin");

Jeff Meredith
[email-masked]