Subject: One problwms in PQlib of POSTGRES

From: Tung-Hsin Su <[email-masked]>
Date: Thu, 11 Nov 93 17:04:22 U

Hi,
   I have one problems in calling library (PQlib) of POSTGRES. 
My problem  is that the "PQputline and PQendcopy" do not work well.
I try the example in PQlib document but it  does not work  and it hangs
up at "PQendcopy" routine call. My program is as follows:

-------------- program begin -----------
#include <stdio.h>
#include "tmp/libpq.h"

main ()
{
    int i, j, k, g, n, m, t;
    PortalBuffer    *p;
    char pnames[MAXPORTALS][portal_name_length];

    /* specify the database to access */
    PQsetdb ("yang");

    PQexec("begin");
    PQexec("create foo ( a=int4, b=char16, d=float8)");
    PQexec("copy foo from stdin");
    PQputline("3        hello world     4.50");
    PQputline("4        goodbye world   7.11");
    PQputline("5        yes             9.0");
    PQputline(".\n");
    if (PQendcopy() != 0 ) {
        printf("error\n");
    }
    if (PQendcopy() != 0 ) {    <<<-- hangs up here !!
        printf("error\n");
    }
    PQexec("end");
    PQfinish ();
}
-------------- end of program ---------- 

+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
|          Name: Tung-Hsin Su                                     |
|    Department: k200, Distributed Computing System Dept.         |
|  Office Phone: (035) 91-7390			       		  |
|    Home Phone: (035) 307330			      		  |
|           Fax: (035) 95-7826			      		  |
|        E-mail: [email-masked]                         |
|Office Address: Computer and Communication Laboratories,         | 
|                Industrial Technology Research Institute         |
|                195-4-w100, Sec. 4, Chun-Hsing Rd.               |
|                Chu-Tung, Hsin-Chu 31015		          | 
|                Taiwan   R.O.C.                                  |
|                                                                 |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+