Re: Listen / Notify - what to do when the queue is full - Mailing list pgsql-hackers

From Arnaud Betremieux
Subject Re: Listen / Notify - what to do when the queue is full
Date
Msg-id 4B4B30C3.9030900@keyconsulting.fr
Whole thread Raw
In response to Re: Listen / Notify - what to do when the queue is full  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 11/01/2010 14:25, Tom Lane wrote:
> Arnaud Betremieux<arnaud.betremieux@keyconsulting.fr>  writes:
>    
>> 3) My use case          : NOTIFY channel 'pay'||'load' (actually NOTIFY
>> channel '<table_name>#'||OLD.id)
>> 4) Taken one step further : NOTIFY channel (SELECT payload FROM payloads
>> WHERE ...)
>>      
>    
>> I'm working on a proof of concept patch to use Joachim's new notify
>> function to introduce case 3. I think this means going through the
>> planner and executor, so I might as well do case 4 as well.
>>      
> It would be a lot less work to introduce a function like send_notify()
> that could be invoked within a regular SELECT.  Pushing a utility
> statement through the planner/executor code path will do enough violence
> to the system design that such a patch would probably be rejected out of
> hand.
>    
Introducing a send_notify function does sound a lot simpler and cleaner, 
and I think I'll try it this way. The only thing that bothers me is the 
syntax :

... DO ALSO SELECT send_notify('payload')
... DO ALSO SELECT send_notify(a) FROM b

How about a new grammar for NOTIFY <channel> a_expr, which would go 
through the rewriter to be transformed as a SELECT ?
so NOTIFY (SELECT a FROM b) would become SELECT send_notify(SELECT a 
FROM b) ?


pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Typed tables
Next
From: Andrew Dunstan
Date:
Subject: Re: mailing list archiver chewing patches