Re: [GENERAL] Create Action for psql when NOTIFY Recieved - Mailing list pgsql-general

From Nico Williams
Subject Re: [GENERAL] Create Action for psql when NOTIFY Recieved
Date
Msg-id 20170905162918.GF3281@localhost
Whole thread Raw
In response to Re: [GENERAL] Create Action for psql when NOTIFY Recieved  (Steve Atkins <steve@blighty.com>)
List pgsql-general
On Tue, Sep 05, 2017 at 08:19:13AM -0700, Steve Atkins wrote:
> > On Sep 4, 2017, at 10:25 PM, Nico Williams <nico@cryptonector.com> wrote:
> > On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins <steve@blighty.com> wrote:
> > > https://github.com/wttw/pgsidekick

[BTW, I must say I like pgsidekick, but for the use of the payload bit.]

> > But the question i have is: how to get such functionality integrated
> > into PostgreSQL?  Is a standalone program (plus manpage plus
> > Makefile changes) enough, or would a psql \wait command be better?
>
> There's not really any need to integrate it into postgresql at all. It
> doesn't rely on any details of the core implementation - it's just a
> normal SQL client, a pretty trivial one.

It's a bit of an FAQ though, isn't it.  I do think it odd that PG has
this functionality on the server side and in the client-side API, but
its client-side utility functionality for it is very limited.

> (Whether psql could usefully be reworked to listen for activity on the
> connection when it's not actively executing a query is another
> question).

A \wait would simply wait for notifications from the server.  It would
be interruptible by ^C, but it would not listen for input on stdin.  I
think that should be a simple-enough patch to psql.

Nico
--


pgsql-general by date:

Previous
From: Steve Atkins
Date:
Subject: Re: [GENERAL] Create Action for psql when NOTIFY Recieved
Next
From: Yan Pas
Date:
Subject: [GENERAL] Postgresql init and cleanup module functions