@@ -179,7 +179,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
179
179
%token NOT_EQ LT_EQ GT_EQ DOT_DOT TYPECAST PLUS_EQ
180
180
181
181
/* keywords in alphabetical order */
182
- %token <keyword> ACCESS ACTION ADMIN ALL ALTER AND ANY ALWAYS ARRAY AS ASC ASCENDING ASYMMETRIC AT ATOMIC AUTHORIZATION
182
+ %token <keyword> ACCESS ACTION ADMIN ALL ALTER AND ANY ALWAYS ARRAY AS ASC ASCENDING ASSIGNMENT ASYMMETRIC AT ATOMIC AUTHORIZATION
183
183
184
184
BIGINT BEGIN_P BETWEEN BOOLEAN_P BOTH BREADTH BY
185
185
@@ -200,7 +200,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
200
200
201
201
HAVING
202
202
203
- IDENTITY_P IF ILIKE IN INCLUDING INDEX INDEXES IMMEDIATE IMMUTABLE INCLUDE INCREMENT INHERIT INHERITS INITIALLY INNER
203
+ IDENTITY_P IF ILIKE IN INCLUDING INDEX INDEXES IMMEDIATE IMMUTABLE IMPLICIT_P INCLUDE INCREMENT INHERIT INHERITS INITIALLY INNER
204
204
INOUT INPUT_P INT_P INTEGER_P INTERSECT INSERT INTERVAL INTO INVOKER IS ISNULL ISOLATION
205
205
206
206
JOIN
@@ -244,7 +244,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
244
244
245
245
%type <node> parse_toplevel stmtmulti schema_stmt routine_body_stmt
246
246
AlterDatabaseStmt AlterDatabaseSetStmt
247
- CreatedbStmt CreateSchemaStmt
247
+ CreateCastStmt CreatedbStmt CreateSchemaStmt
248
248
CreateExtensionStmt CreateFunctionStmt CreateGraphStmt
249
249
CreateTableStmt CreateTableSpaceStmt
250
250
CreateUserStmt
@@ -291,7 +291,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
291
291
%type <integer> generated_when override_kind
292
292
%type <integer> opt_materialized
293
293
294
-
294
+ %type <integer> cast_context
295
295
%type <node> opt_search_clause opt_cycle_clause
296
296
297
297
%type <node> func_application func_expr_common_subexpr
@@ -666,6 +666,7 @@ stmt:
666
666
cypher_stmt
667
667
| AlterDatabaseSetStmt
668
668
| AlterDatabaseStmt
669
+ | CreateCastStmt
669
670
| CreatedbStmt
670
671
| CreateGraphStmt
671
672
| CreateExtensionStmt
@@ -2291,7 +2292,7 @@ cypher_range_idx_opt:
2291
2292
| /* EMPTY */ { $$ = NULL ; }
2292
2293
;
2293
2294
2294
- Iconst : INTEGER
2295
+ Iconst : INTEGER | INTEGER_P
2295
2296
;
2296
2297
/*
2297
2298
* RETURN and WITH clause
@@ -2417,6 +2418,53 @@ having_clause:
2417
2418
;
2418
2419
2419
2420
2421
+ /* ****************************************************************************
2422
+ *
2423
+ * CREATE CAST / DROP CAST
2424
+ *
2425
+ *****************************************************************************/
2426
+
2427
+ CreateCastStmt : CREATE CAST ' (' Typename AS Typename ' )'
2428
+ WITH FUNCTION function_with_argtypes cast_context
2429
+ {
2430
+ CreateCastStmt *n = makeNode(CreateCastStmt);
2431
+ n->sourcetype = $4 ;
2432
+ n->targettype = $6 ;
2433
+ n->func = $10 ;
2434
+ n->context = (CoercionContext) $11 ;
2435
+ n->inout = false ;
2436
+ $$ = (Node *)n;
2437
+ }
2438
+ | CREATE CAST ' (' Typename AS Typename ' )'
2439
+ WITHOUT FUNCTION cast_context
2440
+ {
2441
+ CreateCastStmt *n = makeNode(CreateCastStmt);
2442
+ n->sourcetype = $4 ;
2443
+ n->targettype = $6 ;
2444
+ n->func = NULL ;
2445
+ n->context = (CoercionContext) $10 ;
2446
+ n->inout = false ;
2447
+ $$ = (Node *)n;
2448
+ }
2449
+ | CREATE CAST ' (' Typename AS Typename ' )'
2450
+ WITH INOUT cast_context
2451
+ {
2452
+ CreateCastStmt *n = makeNode(CreateCastStmt);
2453
+ n->sourcetype = $4 ;
2454
+ n->targettype = $6 ;
2455
+ n->func = NULL ;
2456
+ n->context = (CoercionContext) $10 ;
2457
+ n->inout = true ;
2458
+ $$ = (Node *)n;
2459
+ }
2460
+ ;
2461
+
2462
+ cast_context : AS IMPLICIT_P { $$ = COERCION_IMPLICIT; }
2463
+ | AS ASSIGNMENT { $$ = COERCION_ASSIGNMENT; }
2464
+ | /* EMPTY*/ { $$ = COERCION_EXPLICIT; }
2465
+ ;
2466
+
2467
+
2420
2468
2421
2469
/* ****************************************************************************
2422
2470
*
@@ -3223,8 +3271,9 @@ NumericOnly_list: NumericOnly { $$ = list_make1($1); }
3223
3271
| ' +' Iconst { $$ = + $2 ; }
3224
3272
| ' -' Iconst { $$ = - $2 ; }
3225
3273
;
3226
- Iconst : INTEGER { $$ = $1 ; };
3227
-
3274
+ Iconst : INTEGER { $$ = $1 ; }
3275
+ | INTEGER_P
3276
+ ;
3228
3277
3229
3278
3230
3279
@@ -7135,6 +7184,11 @@ Numeric: INT_P
7135
7184
$$ = SystemTypeName (" int4" );
7136
7185
$$->location = @1 ;
7137
7186
}
7187
+ | INTEGER_P
7188
+ {
7189
+ $$ = SystemTypeName (" int4" );
7190
+ $$->location = @1 ;
7191
+ }
7138
7192
| SMALLINT
7139
7193
{
7140
7194
$$ = SystemTypeName (" int2" );
0 commit comments