Re: Concurrent psql patch

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, Jim Nasby <decibel(at)decibel(dot)org>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Concurrent psql patch
Date: 2007-05-24 18:55:00
Message-ID: 4655DF84.50007@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-05-24 19:04:34 Re: Concurrent psql patch
Previous Message Gregory Stark 2007-05-24 18:26:07 Re: Concurrent psql patch

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-05-24 19:04:34 Re: Concurrent psql patch
Previous Message Gregory Stark 2007-05-24 18:26:07 Re: Concurrent psql patch