Skip site navigation (1) Skip section navigation (2)

Re: [pgsql-hackers-win32] Win32 open items

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>,pgsql-hackers-win32(at)postgresql(dot)org,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [pgsql-hackers-win32] Win32 open items
Date: 2004-10-29 19:46:55
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Magnus Hagander wrote:
>> Probably doable, but it requires API additions, I think.

> I thought about this.  There are a lot of pointers in PGconn, and most
> we don't use so I don't like the idea of adding a new API to copy the
> complex PGconn structure just for Win32 psql cancel.  Looking at the
> PQrequestCancel() code, it only writes to errorMessage and reads from
> everything else, and I don't see any of those changing (except
> errorMessage) once the connection is established, so we could do a
> non-deep copy of the structure and reuse all the existing structure
> pointers.  We would just need to create a new errorMessage structure
> because PQrequestCancel() wants to write to that.

I think Magnus had the right idea.  We should invent a completely
separate opaque struct that contains *only* the fields that
PQrequestCancel actually needs (the hostname, port, and secret key;
anything else?) and make a function to create one of these from a
PQconn.  This struct could then be read-only as far as the thread-safe
variant of PQrequestCancel is concerned.

The error message return convention used by PQrequestCancel leaves a lot
to be desired as well; I'd be inclined to think of something else for
the new variant of PQrequestCancel.  Possibly have the caller supply a
buffer to write into.

We could probably reimplement the existing PQrequestCancel on top of the
cleaner version, or at least find some way to share code.  But
basically, the API it has now is pretty bogus.  (I think I can say that,
since I invented it ;-))

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-10-29 19:52:48
Subject: Re: Postgresql crash- any ideas?
Previous:From: Michael GuerinDate: 2004-10-29 19:15:41
Subject: Postgresql crash- any ideas?

pgsql-hackers-win32 by date

Next:From: Dann CorbitDate: 2004-10-31 04:43:35
Subject: Suggestion for holding the hands of the unwashed masses in Win32 land
Previous:From: Bruce MomjianDate: 2004-10-29 19:08:10
Subject: Re: [pgsql-hackers-win32] Win32 open items

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group