Peter T Mount wrote:
>
> On Tue, 3 Mar 1998, Hankin wrote:
>
> > how is a notice sent from the backend?
> > does it send a Nxxxxx\n or a VNxxxxx\n ??
> >
> > Whenever I do a lo_close() I get a NOTICE: tablerelease: no lock found.
> > and PQfn() tries to read a VNxxxxx\n when the backend sends a Nxxxxx\n
>
> This last bit sounds familiar. I thought it was fixed a long time ago
> (after I noticed it while implementing PQfn in Java)
here's a program that duplicates it on my computer...
#include <libpq-fe.h>
#include <libpq/libpq-fs.h>
main()
{
PGconn *connection;
PGresult *result;
Oid oid;
int handle;
char buf[1024];
memset(buf,-1,sizeof(buf));
connection=PQsetdb(NULL,NULL,NULL,NULL,NULL);
if(connection==NULL) { exit(-1); }
PQtrace(connection,stderr);
oid=lo_creat(connection,INV_WRITE);
fprintf(stderr,"lo_creat: %s\n",PQerrorMessage(connection));
handle=lo_open(connection,oid,INV_WRITE);
fprintf(stderr,"lo_open: %s\n",PQerrorMessage(connection));
lo_write(connection,handle,buf,sizeof(buf));
fprintf(stderr,"lo_write: %s\n",PQerrorMessage(connection));
lo_write(connection,handle,buf,sizeof(buf));
fprintf(stderr,"lo_write: %s\n",PQerrorMessage(connection));
lo_close(connection,handle);
fprintf(stderr,"lo_close: %s\n",PQerrorMessage(connection));
result=PQexec(connection,"select aaa from test");
if(result==NULL || PQresultStatus(result)!=PGRES_TUPLES_OK) {
fprintf(stderr,"fail: %s\n",PQerrorMessage(connection)); }
PQfinish(connection);
}