| From: | Peter T Mount <psqlhack(at)maidast(dot)demon(dot)co(dot)uk> | 
|---|---|
| To: | Hankin <hankin(at)dunno(dot)com> | 
| Cc: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: [HACKERS] backend -> interface communication | 
| Date: | 1998-03-03 19:48:10 | 
| Message-ID: | Pine.LNX.3.95.980303194423.25913A-100000@maidast | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Tue, 3 Mar 1998, Hankin wrote:
> 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...
aha, try enclosing everything in a transaction. When I tried the
following:
> #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);
result=PQexec(connection,"begin");
if(result==NULL) {exit(-1);}
> 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)); }
result=PQexec(connection,"end");
if(result==NULL) {exit(-1);}
>         PQfinish(connection);
> }
This then works fine (except that my test database doesn't contain a test
table, so it fails on the select). Removing the select, and it works.
All large object operations need to be in a transaction.
-- 
Peter T Mount  petermount(at)earthling(dot)net or pmount(at)maidast(dot)demon(dot)co(dot)uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter(at)maidstone(dot)gov(dot)uk
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter T Mount | 1998-03-03 20:38:24 | Re: [HACKERS] text should be a blob field | 
| Previous Message | The Hermit Hacker | 1998-03-03 18:26:34 | Re: [HACKERS] doc troubles. |