1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-09 22:41:56 +03:00

Replace the pg_listener-based LISTEN/NOTIFY mechanism with an in-memory queue.

In addition, add support for a "payload" string to be passed along with
each notify event.

This implementation should be significantly more efficient than the old one,
and is also more compatible with Hot Standby usage.  There is not yet any
facility for HS slaves to receive notifications generated on the master,
although such a thing is possible in future.

Joachim Wieland, reviewed by Jeff Davis; also hacked on by me.
This commit is contained in:
Tom Lane
2010-02-16 22:34:57 +00:00
parent fc5173ad51
commit d1e027221d
37 changed files with 1831 additions and 744 deletions

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.708 2010/02/12 17:33:20 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.709 2010/02/16 22:34:49 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -400,7 +400,7 @@ static TypeName *TableFuncTypeName(List *columns);
%type <ival> Iconst SignedIconst
%type <list> Iconst_list
%type <str> Sconst comment_text
%type <str> Sconst comment_text notify_payload
%type <str> RoleId opt_granted_by opt_boolean ColId_or_Sconst
%type <list> var_list
%type <str> ColId ColLabel var_name type_function_name param_name
@ -6123,14 +6123,20 @@ DropRuleStmt:
*
*****************************************************************************/
NotifyStmt: NOTIFY ColId
NotifyStmt: NOTIFY ColId notify_payload
{
NotifyStmt *n = makeNode(NotifyStmt);
n->conditionname = $2;
n->payload = $3;
$$ = (Node *)n;
}
;
notify_payload:
',' Sconst { $$ = $2; }
| /*EMPTY*/ { $$ = NULL; }
;
ListenStmt: LISTEN ColId
{
ListenStmt *n = makeNode(ListenStmt);