Re: Concurrent psql patch - Mailing list pgsql-patches

From Andrew Dunstan
Subject Re: Concurrent psql patch
Date
Msg-id 4655DF84.50007@dunslane.net
Whole thread Raw
In response to Re: Concurrent psql patch  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Concurrent psql patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches

Gregory Stark wrote:
> I expected there would be a few issues raised. For one about the need
> to use PG_ASYNC from libpq-int.h.
>

Hmm, yes.  Maybe we need to export that. I also see:

+ #if 0
+ #include "libpq-int.h" /* For PG_ASYNC */
+ #endif
+

which needs to disappear.

If we're going to include libpq-int.h maybe we need to put it in
common.h. Is there a reason that our own client programs shouldn't use
our own library internals?


> Perhaps what I should do it split it into two patches, one which just adds
> \connect& and \S (switch connection) which will be the larger patch because it
> has to break out the connection structure like you mention. And a second which
> does the asynchronous response handling which is where there may be some
> questions about how to handle things.
>

I don't think that's necessary.
>
>> There are some places that it doesn't use PG style (e.g. no newline before
>> brace after if) and some comments that need to be fixed (e.g. /* XXX get result
>> */ )
>>
>
> Ah, but it's not just the comment, if I put an XXX in it's definitely because
> there's something I'm not certain about. In this case now that I look at it
> again I think it's usually ok to ignore the result but in a session with
> ON_ERROR_STOP set (such as one running a script) we would want to exit I
> think.
>

Seems fair.

> Another XXX is next to the include of libpq-int.h and a third one is where I
> have the pg_sleep loop instead of a select/poll loop. It occurs to me now that
> that loop should check cancel_pressed too.
>
>

Are you talking about polling the connection? Using select/poll except
on a socket is forbidden, because it breaks on Windows.

cheers

andrew

pgsql-patches by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Concurrent psql patch
Next
From: Tom Lane
Date:
Subject: Re: Concurrent psql patch