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
e3accffe
Commit
e3accffe
authored
Aug 21, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syntax for [CONSTRAINT name] CHECK ...
parent
e4247023
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
src/backend/parser/gram.y
src/backend/parser/gram.y
+30
-14
No files found.
src/backend/parser/gram.y
View file @
e3accffe
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.3
7 1997/08/20 01:12:02
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.3
8 1997/08/21 01:34:44
vadim Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -84,6 +84,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
Attr *attr;
ColumnDef *coldef;
ConstaintDef *constrdef;
TypeName *typnam;
DefElem *defelt;
ParamString *param;
...
...
@@ -118,7 +119,9 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
%type <str> relation_name, copy_file_name, copy_delimiter, def_name,
database_name, access_method_clause, access_method, attr_name,
class, index_name, name, file_name, recipe_name,
var_name, aggr_argtype, OptDefault, CheckElem
var_name, aggr_argtype, OptDefault
%type <constrdef> ConstraintElem, ConstraintDef
%type <str> opt_id, opt_portal_name,
before_clause, after_clause, all_Op, MathOp, opt_name, opt_unique,
...
...
@@ -130,7 +133,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
%type <list> stmtblock, stmtmulti,
relation_name_list, OptTableElementList, tableElementList,
OptInherit, OptC
heck, Check
List, definition,
OptInherit, OptC
onstraint, Constraint
List, definition,
opt_with, def_args, def_name_list, func_argtypes,
oper_argtypes, OptStmtList, OptStmtBlock, OptStmtMulti,
opt_column_list, columnList, opt_va_list, va_list,
...
...
@@ -161,7 +164,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
a_expr, a_expr_or_null, AexprConst,
default_expr, default_expr_or_null,
in_expr_nodes, not_in_expr_nodes,
having_clause
, default_expr
having_clause
%type <value> NumConst
%type <attr> event_object, attr
%type <sortgroupby> groupby
...
...
@@ -188,8 +191,8 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
%token ABORT_TRANS, ACL, ADD, AFTER, AGGREGATE, ALL, ALTER, ANALYZE,
AND, APPEND, ARCHIVE, ARCH_STORE, AS, ASC,
BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BINARY, BY,
CAST, CHANGE, CHECK, CLOSE, CLUSTER, COLUMN, COMMIT, CO
PY, CREATE,
CURRENT, CURSOR, DATABASE, DECLARE, DEFAULT, DELETE,
CAST, CHANGE, CHECK, CLOSE, CLUSTER, COLUMN, COMMIT, CO
NSTRAINT,
C
OPY, CREATE, C
URRENT, CURSOR, DATABASE, DECLARE, DEFAULT, DELETE,
DELIMITERS, DESC, DISTINCT, DO, DROP, END_TRANS,
EXTEND, FETCH, FOR, FORWARD, FROM, FUNCTION, GRANT, GROUP,
HAVING, HEAVY, IN, INDEX, INHERITS, INSERT, INSTEAD, INTO, IS,
...
...
@@ -534,14 +537,14 @@ copy_delimiter: USING DELIMITERS Sconst { $$ = $3;}
*****************************************************************************/
CreateStmt: CREATE TABLE relation_name '(' OptTableElementList ')'
OptInherit OptC
heck
OptArchiveType OptLocation
OptInherit OptC
onstraint
OptArchiveType OptLocation
OptArchiveLocation
{
CreateStmt *n = makeNode(CreateStmt);
n->relname = $3;
n->tableElts = $5;
n->inhRelnames = $7;
n->c
heck
= $8;
n->c
onstraints
= $8;
n->archiveType = $9;
n->location = $10;
n->archiveLoc = $11;
...
...
@@ -586,18 +589,28 @@ OptInherit: INHERITS '(' relation_name_list ')' { $$ = $3; }
| /*EMPTY*/ { $$ = NIL; }
;
OptC
heck: Check
List { $$ = $1; }
OptC
onstraint: Constraint
List { $$ = $1; }
| { $$ = NULL; }
;
C
heck
List :
C
heckList ',' Check
Elem
C
onstraint
List :
C
onstraintList ',' Constraint
Elem
{ $$ = lappend($1, $3); }
| C
heck
Elem
| C
onstraint
Elem
{ $$ = lcons($1, NIL); }
;
CheckElem: CHECK a_expr {
ConstraintElem:
CONSTRAINT name ConstraintDef
{
$3->name = $2;
$$ = $3;
}
| ConstraintDef { $$ = $1; }
;
ConstraintDef: CHECK a_expr {
ConstaintDef *constr = palloc (sizeof(ConstaintDef));
int chklen = CurScanPosition() - CheckStartPosition;
char *check;
...
...
@@ -606,7 +619,10 @@ CheckElem: CHECK a_expr {
parseString + CheckStartPosition,
chklen);
check[chklen] = 0;
$$ = check;
constr->type = CONSTR_CHECK;
constr->name = NULL;
constr->expr = check;
$$ = constr;
}
;
...
...
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