grammar.diff
text/x-patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/parser/gram.y | 36 | 1 |
| src/include/parser/kwlist.h | 1 | 0 |
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index bf9dd33..a0a8601 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -355,6 +355,7 @@ static TypeName *TableFuncTypeName(List *columns);
%type <node> def_arg columnElem where_clause where_or_current_clause
a_expr b_expr c_expr func_expr AexprConst indirection_el
columnref in_expr having_clause func_table array_expr
+ exclusion_where_clause
%type <list> func_arg_list
%type <node> func_arg_expr
%type <list> row type_list array_expr_list
@@ -435,6 +436,7 @@ static TypeName *TableFuncTypeName(List *columns);
%type <str> opt_existing_window_name
%type <ival> opt_frame_clause frame_extent frame_bound
+%type <list> ExclusionConstraintList ExclusionConstraintElem
/*
* Non-keyword token types. These are hard-wired into the "flex" lexer.
@@ -478,7 +480,7 @@ static TypeName *TableFuncTypeName(List *columns);
DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P DOUBLE_P DROP
EACH ELSE ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ESCAPE EXCEPT
- EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
+ EXCLUDING EXCLUSION EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
FALSE_P FAMILY FETCH FIRST_P FLOAT_P FOLLOWING FOR FORCE FOREIGN FORWARD
FREEZE FROM FULL FUNCTION FUNCTIONS
@@ -2506,6 +2508,21 @@ ConstraintElem:
n->initdeferred = ($11 & 2) != 0;
$$ = (Node *)n;
}
+ | EXCLUSION access_method_clause '(' ExclusionConstraintList ')'
+ opt_definition OptConsTableSpace exclusion_where_clause
+ ConstraintAttributeSpec
+ {
+ Constraint *n = makeNode(Constraint);
+ n->contype = CONSTR_OPERATOR_EXCLUSION;
+ n->using_method = $2;
+ n->operator_exclusion = $4;
+ n->options = $6;
+ n->indexspace = $7;
+ n->where_clause = $8;
+ n->deferrable = ($9 & 1) != 0;
+ n->initdeferred = ($9 & 2) != 0;
+ $$ = (Node *)n;
+ }
;
opt_column_list:
@@ -2546,6 +2563,23 @@ key_match: MATCH FULL
}
;
+ExclusionConstraintList:
+ ExclusionConstraintElem { $$ = list_make1($1); }
+ | ExclusionConstraintList ',' ExclusionConstraintElem
+ { $$ = lappend($1, $3); }
+ ;
+
+ExclusionConstraintElem: index_elem CHECK WITH any_operator
+ {
+ $$ = list_make2($1, $4);
+ }
+ ;
+
+exclusion_where_clause:
+ WHERE '(' a_expr ')' { $$ = $3; }
+ | /*EMPTY*/ { $$ = NULL; }
+ ;
+
/*
* We combine the update and delete actions into one value temporarily
* for simplicity of parsing, and then break them down again in the
@@ -10772,6 +10806,7 @@ col_name_keyword:
| COALESCE
| DEC
| DECIMAL_P
+ | EXCLUSION
| EXISTS
| EXTRACT
| FLOAT_P
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index d9181d8..e728d98 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -144,6 +144,7 @@ PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD)
PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD)
PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD)
PG_KEYWORD("excluding", EXCLUDING, UNRESERVED_KEYWORD)
+PG_KEYWORD("exclusion", EXCLUSION, COL_NAME_KEYWORD)
PG_KEYWORD("exclusive", EXCLUSIVE, UNRESERVED_KEYWORD)
PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD)
PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD)