Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
bad4bc40
Commit
bad4bc40
authored
Sep 04, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CREATE/DROP TRIGGER syntax
parent
0badb77e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
9 deletions
+102
-9
src/backend/parser/gram.y
src/backend/parser/gram.y
+99
-8
src/backend/parser/keywords.c
src/backend/parser/keywords.c
+3
-1
No files found.
src/backend/parser/gram.y
View file @
bad4bc40
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.4
1 1997/09/01 06:00:35 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.4
2 1997/09/04 13:24:25 vadim
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -107,7 +107,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
%type <node> stmt,
AddAttrStmt, ClosePortalStmt,
CopyStmt, CreateStmt, CreateSeqStmt, DefineStmt, DestroyStmt,
ExtendStmt, FetchStmt, GrantStmt,
ExtendStmt, FetchStmt, GrantStmt,
CreateTrigStmt, DropTrigStmt,
IndexStmt, MoveStmt, ListenStmt, OptimizableStmt,
ProcedureStmt, PurgeStmt,
RecipeStmt, RemoveAggrStmt, RemoveOperStmt, RemoveFuncStmt, RemoveStmt,
...
...
@@ -119,9 +119,9 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
%type <str> txname
%type <node> SubSelect
%type <str> join_clause, join_type, join_outer, join_spec
%type <boolean> join_qual
%type <boolean> join_qual
, TriggerActionTime, TriggerForSpec
%type <str> datetime
%type <str> datetime
, TriggerEvents, TriggerFuncArg
%type <str> relation_name, copy_file_name, copy_delimiter, def_name,
database_name, access_method_clause, access_method, attr_name,
...
...
@@ -136,7 +136,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
SpecialRuleRelation
%type <str> privileges, operation_commalist, grantee
%type <chr> operation
%type <chr> operation
, TriggerOneEvent
%type <list> stmtblock, stmtmulti,
relation_name_list, OptTableElementList, tableElementList,
...
...
@@ -147,7 +147,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
sort_clause, sortby_list, index_params, index_list, name_list,
from_clause, from_list, opt_array_bounds, nest_array_bounds,
expr_list, default_expr_list, attrs, res_target_list, res_target_list2,
def_list, opt_indirection, group_clause, groupby_list
def_list, opt_indirection, group_clause, groupby_list
, TriggerFuncArgs
%type <list> union_clause, select_list
%type <list> join_list
...
...
@@ -217,10 +217,10 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
MERGE, MINUTEINTERVAL, MONTHINTERVAL, MOVE,
NATURAL, NEW, NONE, NOT, NOTHING, NOTIFY, NOTNULL,
OIDS, ON, OPERATOR, OPTION, OR, ORDER, OUTERJOIN,
PNULL, POSITION, PRIVILEGES, PUBLIC, PURGE, P_TYPE,
PNULL, POSITION, PRIVILEGES, P
ROCEDURE, P
UBLIC, PURGE, P_TYPE,
RENAME, REPLACE, RESET, RETRIEVE, RETURNS, REVOKE, RIGHT, ROLLBACK, RULE,
SECONDINTERVAL, SELECT, SET, SETOF, SHOW, STDIN, STDOUT, STORE, SUBSTRING,
TABLE, TIME, TO, TRAILING, TRANSACTION, TRIM,
TABLE, TIME, TO, TRAILING, TRANSACTION, TRI
GGER, TRI
M,
UNION, UNIQUE, UPDATE, USING, VACUUM, VALUES,
VERBOSE, VERSION, VIEW, WHERE, WITH, WORK, YEARINTERVAL, ZONE
%token EXECUTE, RECIPE, EXPLAIN, LIKE, SEQUENCE
...
...
@@ -278,9 +278,11 @@ stmt : AddAttrStmt
| CopyStmt
| CreateStmt
| CreateSeqStmt
| CreateTrigStmt
| ClusterStmt
| DefineStmt
| DestroyStmt
| DropTrigStmt
| ExtendStmt
| ExplainStmt
| FetchStmt
...
...
@@ -713,6 +715,95 @@ OptSeqElem: IDENT NumConst
;
/*****************************************************************************
*
* QUERIES :
* CREATE TRIGGER ...
* DROP TRIGGER ...
*
*****************************************************************************/
CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON
relation_name TriggerForSpec EXECUTE PROCEDURE
name '(' TriggerFuncArgs ')'
{
CreateTrigStmt *n = makeNode(CreateTrigStmt);
n->trigname = $3;
n->relname = $7;
n->funcname = $11;
n->args = $13;
n->before = $4;
n->row = $8;
memcpy (n->actions, $5, 4);
$$ = (Node *)n;
}
;
TriggerActionTime: BEFORE { $$ = true; }
| AFTER { $$ = false; }
;
TriggerEvents: TriggerOneEvent
{
char *e = palloc (4);
e[0] = $1; e[1] = 0; $$ = e;
}
| TriggerOneEvent OR TriggerOneEvent
{
char *e = palloc (4);
e[0] = $1; e[1] = $3; e[2] = 0; $$ = e;
}
| TriggerOneEvent OR TriggerOneEvent OR TriggerOneEvent
{
char *e = palloc (4);
e[0] = $1; e[1] = $3; e[2] = $5; e[3] = 0;
$$ = e;
}
;
TriggerOneEvent: INSERT { $$ = 'i'; }
| DELETE { $$ = 'd'; }
| UPDATE { $$ = 'u'; }
;
TriggerForSpec: FOR name name
{
if ( strcmp ($2, "each") != 0 )
elog (WARN, "parser: syntax error near %s", $2);
if ( strcmp ($3, "row") == 0 )
$$ = true;
else if ( strcmp ($3, "statement") == 0 )
$$ = false;
else
elog (WARN, "parser: syntax error near %s", $3);
}
;
TriggerFuncArgs: TriggerFuncArg
{ $$ = lcons($1, NIL); }
| TriggerFuncArgs ',' TriggerFuncArg
{ $$ = lappend($1, $3); }
| /* EMPTY */ { $$ = NIL; }
;
TriggerFuncArg: ICONST
{
char *s = (char *) palloc (256);
sprintf (s, "%d", $1);
$$ = s;
}
| Sconst { $$ = $1; }
;
DropTrigStmt: DROP TRIGGER name ON relation_name
{
DropTrigStmt *n = makeNode(DropTrigStmt);
n->trigname = $3;
n->relname = $5;
$$ = (Node *) n;
}
;
/*****************************************************************************
*
* QUERY :
...
...
src/backend/parser/keywords.c
View file @
bad4bc40
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.1
3 1997/09/01 05:53:31 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.1
4 1997/09/04 13:24:26 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -133,6 +133,7 @@ static ScanKeyword ScanKeywords[] = {
{
"outer"
,
OUTERJOIN
},
{
"position"
,
POSITION
},
{
"privileges"
,
PRIVILEGES
},
{
"procedure"
,
PROCEDURE
},
{
"public"
,
PUBLIC
},
{
"purge"
,
PURGE
},
{
"recipe"
,
RECIPE
},
...
...
@@ -160,6 +161,7 @@ static ScanKeyword ScanKeywords[] = {
{
"to"
,
TO
},
{
"transaction"
,
TRANSACTION
},
{
"trailing"
,
TRAILING
},
{
"trigger"
,
TRIGGER
},
{
"trim"
,
TRIM
},
{
"type"
,
P_TYPE
},
{
"union"
,
UNION
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment