Re: Create Action for psql when NOTIFY Recieved

From: Nico Williams <nico(at)cryptonector(dot)com>
To: Steve Atkins <steve(at)blighty(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Create Action for psql when NOTIFY Recieved
Date: 2017-09-05 05:25:54
Message-ID: CAK3OfOhm-oeTxx3akHfO6d8emMr_V-8zn4GiX9DTDjBAeyg7Rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins <steve(at)blighty(dot)com> wrote:

> >
>
> Me too.
>
> https://github.com/wttw/pgsidekick
>
> Select-based, sends periodic keep-alives to keep the connection open,
> outputs payloads in a way that's friendly to pipe into xargs. (Also the
> bare bones of a notify-based scheduler).

Without any kind of access controls on NOTIFY channels, nor any kind of
payload validation, i just don't feel comfortable using the payload at
all. Besides, the payload is hardly necessary given that there's a
database on which you can scribble the payload :) It suffices that you
receive a notification, and you can then check if there's anything to do.

My version of this doesn't have connection keepalives, but that's ok
because that can be added in the form of.... notifications, and the
consumer of pqasyncnotifier can implement timeouts. But i agree that
timeouts and keepalives would be nice, and even invoking a given SQL
function would be nice.

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?

Nico
--

>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Glen Huang 2017-09-05 06:53:11 Not possible to compare regrole in a view query?
Previous Message Ryan Murphy 2017-09-05 03:42:52 Re: What's the best way in postgres to use ANY() with LIKE '%'?