Re: Create Action for psql when NOTIFY Recieved

From: Nico Williams <nico(at)cryptonector(dot)com>
To: Steve Atkins <steve(at)blighty(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Create Action for psql when NOTIFY Recieved
Date: 2017-09-05 16:29:20
Message-ID: 20170905162918.GF3281@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cryptonector(dot)com> wrote:
> > On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins <steve(at)blighty(dot)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
--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yan Pas 2017-09-05 17:15:57 Postgresql init and cleanup module functions
Previous Message Steve Atkins 2017-09-05 15:19:13 Re: Create Action for psql when NOTIFY Recieved