Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-05 Thread Nico Williams
On Tue, Sep 05, 2017 at 08:19:13AM -0700, Steve Atkins wrote: > > On Sep 4, 2017, at 10:25 PM, Nico Williams wrote: > > On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins wrote: > > > https://github.com/wttw/pgsidekick [BTW, I must say I like pgsidekick, but for the use of the payload bit.] > > But th

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-05 Thread Steve Atkins
> On Sep 4, 2017, at 10:25 PM, Nico Williams wrote: > > On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins 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 in

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-04 Thread Nico Williams
On Mon, Sep 4, 2017 at 4:21 PM Steve Atkins 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).

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-04 Thread Steve Atkins
> On Sep 3, 2017, at 3:32 PM, Nico Williams wrote: > > > My principal problem with psql(1) relative to NOTIFY/LISTEN is that > psql(1) won't check for them until it has had some input on stdin. So > it will appear to do nothing when it's idle, even if there millions of > notifies for it to res

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-03 Thread Nico Williams
On Sun, Sep 03, 2017 at 05:37:57PM -0500, Nico Williams wrote: > What would it take to have pqasyncnotifier [0] adopted by PostgreSQL? Maybe it should be named pqasynclisterner. A \wait command for psql could do the same thing. I could probably write such a patch at some point if there's interes

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-03 Thread Nico Williams
[I meant to send this to the list] On Mon, Aug 28, 2017 at 07:08:28PM -0400, Tom Lane wrote: > "David G. Johnston" writes: > > On Mon, Aug 28, 2017 at 1:28 PM, Jerry Regan < > > jerry.re...@concertoglobalresources.com> wrote: > >> My concern is how, after LISTENing in psql, I can tell it what to

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-09-03 Thread Nico Williams
My principal problem with psql(1) relative to NOTIFY/LISTEN is that psql(1) won't check for them until it has had some input on stdin. So it will appear to do nothing when it's idle, even if there millions of notifies for it to respond to! So I wrote a program to just LISTEN: https://github.com

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread Jerry Regan
Stuart, Thank you! I will investigate. /s/jr Consultant Concerto GR Mobile: 612.208.6601 Concerto - a composition for orchestra and a soloist > On 29Aug, 2017, at 7:52 AM, Stuart Bishop wrote: > > On 29 August 2017 at 08:42, Jerry Regan > wrote: >> Tom, >> >> After a few minutes thought…

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread John McKown
On Tue, Aug 29, 2017 at 10:21 AM, Daniel Verite wrote: > Jerry Regan wrote: > > > I think I could justify the effort to ‘script’ psql. I’m not so sure I > can > > justify the effort to write a standalone program. > > As a hack around psql, you could have a script that feeds psql > with "S

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread Daniel Verite
Jerry Regan wrote: > I think I could justify the effort to ‘script’ psql. I’m not so sure I can > justify the effort to write a standalone program. As a hack around psql, you could have a script that feeds psql with "SELECT 1" from time to time and capture only the notifications output:

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread Stuart Bishop
On 29 August 2017 at 08:42, Jerry Regan wrote: > Tom, > > After a few minutes thought….. > > /s/jr > Consultant > Concerto GR > Mobile: 612.208.6601 > > Concerto - a composition for orchestra and a soloist > > > > On 28Aug, 2017, at 6:08 PM, Tom Lane wrote: > > "David G. Johnston" writes: > > On

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread Jerry Regan
Tom, After a few minutes thought….. /s/jr Consultant Concerto GR Mobile: 612.208.6601 Concerto - a composition for orchestra and a soloist > On 28Aug, 2017, at 6:08 PM, Tom Lane wrote: > > "David G. Johnston" writes: >> On Mon, Aug 28, 2017 at 1:28 PM, Jerry Regan < >> jerry.re...@concerto

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread Jerry Regan
David, Thanks for your response! /s/jr Consultant Concerto GR Mobile: 612.208.6601 Concerto - a composition for orchestra and a soloist > On 28Aug, 2017, at 5:36 PM, David G. Johnston > wrote: > > On Mon, Aug 28, 2017 at 1:28 PM, Jerry Regan >

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-29 Thread Jerry Regan
Tom, I understand all you’ve said. I was hoping for a different answer. C’est la vie. I think I could justify the effort to ‘script’ psql. I’m not so sure I can justify the effort to write a standalone program. At least I have an answer. Thanks! /s/jr Consultant Concerto GR Mobile: 612.208.66

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-28 Thread David G. Johnston
On Mon, Aug 28, 2017 at 6:42 PM, Jerry Regan < jerry.re...@concertoglobalresources.com> wrote: > Let’s suppose for a moment that I piped the output of a psql instance to > awk or some similar program, configured to detect the NOTIFY. That program > would then spawn a process to actually perform th

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-28 Thread Tom Lane
"David G. Johnston" writes: > On Mon, Aug 28, 2017 at 1:28 PM, Jerry Regan < > jerry.re...@concertoglobalresources.com> wrote: >> My concern is how, after LISTENing in psql, I can tell it what to do when >> the NOTItFY is received. > ​As far as I am aware you cannot. Yes, and psql is not designe

Re: [GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-28 Thread David G. Johnston
On Mon, Aug 28, 2017 at 1:28 PM, Jerry Regan < jerry.re...@concertoglobalresources.com> wrote: > My concern is how, after LISTENing in psql, I can tell it what to do when > the NOTItFY is received. > ​As far as I am aware you cannot. The docs for psql, and its feature set, with respect to LISTEN

[GENERAL] Create Action for psql when NOTIFY Recieved

2017-08-28 Thread Jerry Regan
I have a 9.4 database. I think I’ve read all the LISTEN and NOTIFY entries in PostgreSQL documentation. I’ve done internet searches, hopefully asking the correct question. But I’m stumped. I want psql to LISTEN for a NOTIFY that a trigger, yet to be defined, issues AFTER INSERT into the table.