Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf62d125

Browse files
committed
From: Massimo Dal Zotto <dz@cs.unitn.it>> these patches define the UNLISTEN sql command. The code already> existed but it was unknown to the parser. Now it can be used> like the listen command.> You must make clean and delete gram.c and parser.h before make.
1 parent7414d61 commitf62d125

File tree

9 files changed

+58
-13
lines changed

9 files changed

+58
-13
lines changed

‎src/backend/parser/gram.y

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.25 1998/08/2515:04:23 thomas Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.26 1998/08/2521:36:53 scrappy Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -122,7 +122,7 @@ Oidparam_type(int t); /* used in parse_expr.c */
122122
CopyStmt, CreateStmt, CreateAsStmt, CreateSeqStmt, DefineStmt, DestroyStmt,
123123
ExtendStmt, FetchStmt,GrantStmt, CreateTrigStmt, DropTrigStmt,
124124
CreatePLangStmt, DropPLangStmt,
125-
IndexStmt, ListenStmt, LockStmt, OptimizableStmt,
125+
IndexStmt, ListenStmt,UnlistenStmt,LockStmt, OptimizableStmt,
126126
ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt,
127127
RemoveFuncStmt, RemoveStmt,
128128
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
@@ -378,6 +378,7 @@ stmt : AddAttrStmt
378378
| GrantStmt
379379
| IndexStmt
380380
| ListenStmt
381+
| UnlistenStmt
381382
| LockStmt
382383
| ProcedureStmt
383384
| RecipeStmt
@@ -2039,6 +2040,14 @@ ListenStmt: LISTEN relation_name
20392040
}
20402041
;
20412042

2043+
UnlistenStmt: UNLISTEN relation_name
2044+
{
2045+
UnlistenStmt *n = makeNode(UnlistenStmt);
2046+
n->relname = $2;
2047+
$$ = (Node *)n;
2048+
}
2049+
;
2050+
20422051

20432052
/*****************************************************************************
20442053
*

‎src/backend/parser/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.41 1998/08/2515:04:24 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.42 1998/08/2521:36:55 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -209,6 +209,7 @@ static ScanKeyword ScanKeywords[] = {
209209
{"type",TYPE_P},
210210
{"union",UNION},
211211
{"unique",UNIQUE},
212+
{"unlisten",UNLISTEN},
212213
{"until",UNTIL},
213214
{"update",UPDATE},
214215
{"user",USER},

‎src/backend/tcop/utility.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.47 1998/08/25 21:24:09 scrappy Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.48 1998/08/25 21:36:56 scrappy Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -594,6 +594,17 @@ ProcessUtility(Node *parsetree,
594594
}
595595
break;
596596

597+
caseT_UnlistenStmt:
598+
{
599+
UnlistenStmt*stmt= (UnlistenStmt*)parsetree;
600+
601+
PS_SET_STATUS(commandTag="UNLISTEN" );
602+
CHECK_IF_ABORTED();
603+
604+
Async_Unlisten(stmt->relname,MyProcPid);
605+
}
606+
break;
607+
597608
/*
598609
* ******************************** dynamic loader ********************************
599610
*

‎src/bin/psql/psqlHelp.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.49 1998/07/26 01:18:09 momjian Exp $
8+
* $Id: psqlHelp.h,v 1.50 1998/08/25 21:36:58 scrappy Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -273,9 +273,9 @@ static struct _helpStruct QL_HELP[] = {
273273
\t[HAVING having_clause]\n\
274274
\t[UNION [ALL] SELECT ...];"},
275275
{"listen",
276-
"listen for notification on a relation",
276+
"listen for notification on a relation name",
277277
"\
278-
\tLISTEN class_name"},
278+
\tLISTEN class_name|\"name\""},
279279
{"load",
280280
"dynamically load a module",
281281
"\
@@ -345,7 +345,11 @@ set R_PLANS TO 'ON'| 'OFF'"},
345345
"\
346346
\tSHOW DateStyle|GEQO|R_PLANS"},
347347
#endif
348-
{"UPDATE",
348+
{"unlisten",
349+
"unlisten for notification on a relation name",
350+
"\
351+
\tUNLISTEN class_name|\"name\"|\"*\""},
352+
{"update",
349353
"update tuples",
350354
"\
351355
\tUPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\

‎src/include/commands/async.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: async.h,v 1.7 1997/09/08 02:35:37 momjian Exp $
9+
* $Id: async.h,v 1.8 1998/08/25 21:37:00 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -20,6 +20,7 @@ extern void Async_Notify(char *relname);
2020
externvoidAsync_NotifyAtCommit(void);
2121
externvoidAsync_NotifyAtAbort(void);
2222
externvoidAsync_Listen(char*relname,intpid);
23+
externvoidAsync_Unlisten(char*relname,intpid);
2324

2425
externGlobalMemorynotifyContext;
2526

‎src/include/nodes/nodes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: nodes.h,v 1.27 1998/08/18 00:49:01 scrappy Exp $
9+
* $Id: nodes.h,v 1.28 1998/08/25 21:37:02 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -171,6 +171,7 @@ typedef enum NodeTag
171171
T_RuleStmt,
172172
T_NotifyStmt,
173173
T_ListenStmt,
174+
T_UnlistenStmt,
174175
T_TransactionStmt,
175176
T_ViewStmt,
176177
T_LoadStmt,

‎src/include/nodes/parsenodes.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: parsenodes.h,v 1.56 1998/08/2515:09:31 thomas Exp $
9+
* $Id: parsenodes.h,v 1.57 1998/08/2521:37:04 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -440,6 +440,16 @@ typedef struct ListenStmt
440440
char*relname;/* relation to listen on */
441441
}ListenStmt;
442442

443+
/* ----------------------
444+
*Unlisten Statement
445+
* ----------------------
446+
*/
447+
typedefstructUnlistenStmt
448+
{
449+
NodeTagtype;
450+
char*relname;/* relation to unlisten on */
451+
}UnlistenStmt;
452+
443453
/* ----------------------
444454
*{Begin|Abort|End} Transaction Statement
445455
* ----------------------

‎src/interfaces/ecpg/preproc/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.2 1998/05/18 16:05:00 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.3 1998/08/25 21:37:06 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -201,6 +201,7 @@ static ScanKeyword ScanKeywords[] = {
201201
{"type",TYPE_P},
202202
{"union",UNION},
203203
{"unique",UNIQUE},
204+
{"unlisten",UNLISTEN},
204205
{"until",UNTIL},
205206
{"update",UPDATE},
206207
{"user",USER},

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ output_statement(char * stmt, int mode)
563563
DATABASE,DELIMITERS,DO,EACH,EXPLAIN,EXTEND,
564564
FORWARD,FUNCTION,HANDLER,
565565
INCREMENT,INDEX,INHERITS,INSTEAD,ISNULL,
566-
LANCOMPILER,LISTEN,LOAD,LOCK_P,LOCATION,MAXVALUE,MINVALUE,MOVE,
566+
LANCOMPILER,LISTEN,UNLISTEN,LOAD,LOCK_P,LOCATION,MAXVALUE,MINVALUE,MOVE,
567567
NEW,NONE,NOTHING,NOTNULL,OIDS,OPERATOR,PROCEDURAL,
568568
RECIPE,RENAME,RESET,RETURNS,ROW,RULE,
569569
SEQUENCE,SETOF,SHOW,START,STATEMENT,STDIN,STDOUT,TRUSTED,
@@ -723,6 +723,7 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
723723
|GrantStmt{ output_statement($1,0); }
724724
|IndexStmt{ output_statement($1,0); }
725725
|ListenStmt{ output_statement($1,0); }
726+
|UnlistenStmt{ output_statement($1,0); }
726727
|LockStmt{ output_statement($1,0); }
727728
|ProcedureStmt{ output_statement($1,0); }
728729
|RecipeStmt{ output_statement($1,0); }
@@ -2108,6 +2109,12 @@ ListenStmt: LISTEN relation_name
21082109
}
21092110
;
21102111

2112+
UnlistenStmt:UNLISTENrelation_name
2113+
{
2114+
$$ = cat2_str(make1_str("unlisten"),$2);
2115+
}
2116+
;
2117+
21112118
/*****************************************************************************
21122119
*
21132120
* Transactions:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp