Commit 97862234 authored by Michael Meskes's avatar Michael Meskes

Committing parser changes. Note, however, that the development bison seems ot...

Committing parser changes. Note, however, that the development bison seems ot have a problem on my home machine. So these go in untested for the time being. But at least I have them in the archive.

Michael
parent 95a5f7d8
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.50 2002/06/20 20:29:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.51 2002/06/30 09:34:13 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -44,6 +44,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -44,6 +44,7 @@ static ScanKeyword ScanKeywords[] = {
{"as", AS}, {"as", AS},
{"asc", ASC}, {"asc", ASC},
{"assertion", ASSERTION}, {"assertion", ASSERTION},
{"assignment", ASSIGNMENT},
{"at", AT}, {"at", AT},
{"authorization", AUTHORIZATION}, {"authorization", AUTHORIZATION},
{"backward", BACKWARD}, {"backward", BACKWARD},
...@@ -98,6 +99,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -98,6 +99,7 @@ static ScanKeyword ScanKeywords[] = {
{"deferred", DEFERRED}, {"deferred", DEFERRED},
{"definer", DEFINER}, {"definer", DEFINER},
{"delete", DELETE_P}, {"delete", DELETE_P},
{"delimiter", DELIMITER},
{"delimiters", DELIMITERS}, {"delimiters", DELIMITERS},
{"desc", DESC}, {"desc", DESC},
{"distinct", DISTINCT}, {"distinct", DISTINCT},
...@@ -171,6 +173,8 @@ static ScanKeyword ScanKeywords[] = { ...@@ -171,6 +173,8 @@ static ScanKeyword ScanKeywords[] = {
{"listen", LISTEN}, {"listen", LISTEN},
{"load", LOAD}, {"load", LOAD},
{"local", LOCAL}, {"local", LOCAL},
{"localtime", LOCALTIME},
{"localtimestamp", LOCALTIMESTAMP},
{"location", LOCATION}, {"location", LOCATION},
{"lock", LOCK_P}, {"lock", LOCK_P},
{"match", MATCH}, {"match", MATCH},
...@@ -211,11 +215,13 @@ static ScanKeyword ScanKeywords[] = { ...@@ -211,11 +215,13 @@ static ScanKeyword ScanKeywords[] = {
{"out", OUT_P}, {"out", OUT_P},
{"outer", OUTER_P}, {"outer", OUTER_P},
{"overlaps", OVERLAPS}, {"overlaps", OVERLAPS},
{"overlay", OVERLAY},
{"owner", OWNER}, {"owner", OWNER},
{"partial", PARTIAL}, {"partial", PARTIAL},
{"password", PASSWORD}, {"password", PASSWORD},
{"path", PATH_P}, {"path", PATH_P},
{"pendant", PENDANT}, {"pendant", PENDANT},
{"placing", PLACING},
{"position", POSITION}, {"position", POSITION},
{"precision", PRECISION}, {"precision", PRECISION},
{"primary", PRIMARY}, {"primary", PRIMARY},
...@@ -251,6 +257,8 @@ static ScanKeyword ScanKeywords[] = { ...@@ -251,6 +257,8 @@ static ScanKeyword ScanKeywords[] = {
{"setof", SETOF}, {"setof", SETOF},
{"share", SHARE}, {"share", SHARE},
{"show", SHOW}, {"show", SHOW},
{"similar", SIMILAR},
{"simple", SIMPLE},
{"smallint", SMALLINT}, {"smallint", SMALLINT},
{"some", SOME}, {"some", SOME},
{"stable", STABLE}, {"stable", STABLE},
...@@ -292,6 +300,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -292,6 +300,7 @@ static ScanKeyword ScanKeywords[] = {
{"using", USING}, {"using", USING},
{"vacuum", VACUUM}, {"vacuum", VACUUM},
{"valid", VALID}, {"valid", VALID},
{"validator", VALIDATOR},
{"values", VALUES}, {"values", VALUES},
{"varchar", VARCHAR}, {"varchar", VARCHAR},
{"varying", VARYING}, {"varying", VARYING},
...@@ -304,6 +313,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -304,6 +313,7 @@ static ScanKeyword ScanKeywords[] = {
{"with", WITH}, {"with", WITH},
{"without", WITHOUT}, {"without", WITHOUT},
{"work", WORK}, {"work", WORK},
{"write", WRITE},
{"year", YEAR_P}, {"year", YEAR_P},
{"zone", ZONE}, {"zone", ZONE},
}; };
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.94 2002/06/20 20:29:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.95 2002/06/30 09:34:13 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -89,14 +89,14 @@ static struct _if_value ...@@ -89,14 +89,14 @@ static struct _if_value
* We use exclusive states for quoted strings, extended comments, * We use exclusive states for quoted strings, extended comments,
* and to eliminate parsing troubles for numeric strings. * and to eliminate parsing troubles for numeric strings.
* Exclusive states: * Exclusive states:
* <xbit> bit string literal * <xb> bit string literal
* <xc> extended C-style comments - thomas 1997-07-12 * <xc> extended C-style comments - thomas 1997-07-12
* <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27 * <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
* <xh> hexadecimal numeric string - thomas 1997-11-16 * <xh> hexadecimal numeric string - thomas 1997-11-16
* <xq> quoted strings - thomas 1997-07-30 * <xq> quoted strings - thomas 1997-07-30
*/ */
%x xbit %x xb
%x xc %x xc
%x xd %x xd
%x xdc %x xdc
...@@ -108,10 +108,10 @@ static struct _if_value ...@@ -108,10 +108,10 @@ static struct _if_value
/* Bit string /* Bit string
*/ */
xbitstart [bB]{quote} xbstart [bB]{quote}
xbitstop {quote} xbstop {quote}
xbitinside [^']* xbinside [^']*
xbitcat {quote}{whitespace_with_newline}{quote} xbcat {quote}{whitespace_with_newline}{quote}
/* Hexadecimal number /* Hexadecimal number
*/ */
...@@ -318,13 +318,13 @@ cppline {space}*#(.*\\{space})*.* ...@@ -318,13 +318,13 @@ cppline {space}*#(.*\\{space})*.*
<xc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated /* comment"); } <xc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated /* comment"); }
<SQL>{xbitstart} { <SQL>{xbstart} {
token_start = yytext; token_start = yytext;
BEGIN(xbit); BEGIN(xb);
startlit(); startlit();
addlitchar('b'); addlitchar('b');
} }
<xbit>{xbitstop} { <xb>{xbstop} {
BEGIN(SQL); BEGIN(SQL);
if (literalbuf[strspn(literalbuf, "01") + 1] != '\0') if (literalbuf[strspn(literalbuf, "01") + 1] != '\0')
mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string input."); mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string input.");
...@@ -333,10 +333,10 @@ cppline {space}*#(.*\\{space})*.* ...@@ -333,10 +333,10 @@ cppline {space}*#(.*\\{space})*.*
} }
<xh>{xhinside} | <xh>{xhinside} |
<xbit>{xbitinside} { addlit(yytext, yyleng); } <xb>{xbinside} { addlit(yytext, yyleng); }
<xh>{xhcat} | <xh>{xhcat} |
<xbit>{xbitcat} { /* ignore */ } <xb>{xbcat} { /* ignore */ }
<xbit><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); } <xb><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated bit string"); }
<SQL>{xhstart} { <SQL>{xhstart} {
token_start = yytext; token_start = yytext;
...@@ -378,7 +378,7 @@ cppline {space}*#(.*\\{space})*.* ...@@ -378,7 +378,7 @@ cppline {space}*#(.*\\{space})*.*
<xq>{xqdouble} { addlitchar('\''); } <xq>{xqdouble} { addlitchar('\''); }
<xq>{xqinside} { addlit(yytext, yyleng); } <xq>{xqinside} { addlit(yytext, yyleng); }
<xq>{xqescape} { addlit(yytext, yyleng); } <xq>{xqescape} { addlit(yytext, yyleng); }
<xq>{xqoctesc} { addlit(yytext, yyleng); } <xq>{xqoctesc} { addlit(yytext, yyleng); } /* addlitchar does not work here since character must remain octal */
<xq>{xqcat} { /* ignore */ } <xq>{xqcat} { /* ignore */ }
<xq><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted string"); } <xq><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted string"); }
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.190 2002/06/11 13:40:52 wieck Exp $ */ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.191 2002/06/30 09:34:14 meskes Exp $ */
/* Copyright comment */ /* Copyright comment */
%{ %{
...@@ -179,7 +179,7 @@ make_name(void) ...@@ -179,7 +179,7 @@ make_name(void)
/* ordinary key words in alphabetical order */ /* ordinary key words in alphabetical order */
%token <keyword> ABORT_TRANS, ABSOLUTE, ACCESS, ACTION, ADD, AFTER, %token <keyword> ABORT_TRANS, ABSOLUTE, ACCESS, ACTION, ADD, AFTER,
AGGREGATE, ALL, ALTER, ANALYSE, ANALYZE, AND, ANY, AS, ASC, ASSERTION, AGGREGATE, ALL, ALTER, ANALYSE, ANALYZE, AND, ANY, AS, ASC, ASSERTION,
AT, AUTHORIZATION, ASSIGNMENT, AT, AUTHORIZATION,
BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH, BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
BOOLEAN, BY, BOOLEAN, BY,
...@@ -191,14 +191,14 @@ make_name(void) ...@@ -191,14 +191,14 @@ make_name(void)
CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,
DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED,
DEFINER, DELETE_P, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP, DEFINER, DELETE_P, DELIMITER, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,
EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE, EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT, EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,
FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM, FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM,
FULL, FUNCTION, FULL, FUNCTION,
GLOBAL, GRANT, GROUP_P, GET, GLOBAL, GRANT, GROUP_P,
HANDLER, HAVING, HOUR_P, HANDLER, HAVING, HOUR_P,
ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS, ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS,
...@@ -209,7 +209,7 @@ make_name(void) ...@@ -209,7 +209,7 @@ make_name(void)
KEY, KEY,
LANCOMPILER, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LIMIT, LISTEN, LANCOMPILER, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LIMIT, LISTEN,
LOAD, LOCAL, LOCATION, LOCK_P, LOAD, LOCAL, LOCALTIME, LOCALTIMESTAMP, LOCATION, LOCK_P,
MATCH, MAXVALUE, MINUTE_P, MINVALUE, MODE, MONTH_P, MOVE, MATCH, MAXVALUE, MINUTE_P, MINVALUE, MODE, MONTH_P, MOVE,
...@@ -218,16 +218,17 @@ make_name(void) ...@@ -218,16 +218,17 @@ make_name(void)
NUMERIC, NUMERIC,
OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER, OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER,
OUT_P, OUTER_P, OVERLAPS, OWNER, OUT_P, OUTER_P, OVERLAPS, OVERLAY, OWNER,
PARTIAL, PASSWORD, PATH_P, PENDANT, POSITION, PRECISION, PRIMARY, PARTIAL, PASSWORD, PATH_P, PENDANT, PLACING, POSITION, PRECISION, PRIMARY,
PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL, PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
READ, REAL, REFERENCES, REINDEX, RELATIVE, RENAME, REPLACE, RESET, READ, REAL, REFERENCES, REINDEX, RELATIVE, RENAME, REPLACE, RESET,
RESTRICT, RETURNS, REVOKE, RIGHT, ROLLBACK, ROW, RULE, RESTRICT, RETURNS, REVOKE, RIGHT, ROLLBACK, ROW, RULE,
SCHEMA, SCROLL, SECOND_P, SECURITY, SELECT, SEQUENCE, SERIALIZABLE, SCHEMA, SCROLL, SECOND_P, SECURITY, SELECT, SEQUENCE, SERIALIZABLE,
SESSION, SESSION_USER, SET, SETOF, SHARE, SHOW, SMALLINT, SOME, SESSION, SESSION_USER, SET, SETOF, SHARE, SHOW, SIMILAR, SIMPLE,
SMALLINT, SOME,
STABLE, START, STATEMENT, STATISTICS, STDIN, STDOUT, STORAGE, STRICT, STABLE, START, STATEMENT, STATISTICS, STDIN, STDOUT, STORAGE, STRICT,
SUBSTRING, SYSID, SUBSTRING, SYSID,
...@@ -236,8 +237,8 @@ make_name(void) ...@@ -236,8 +237,8 @@ make_name(void)
UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UNLISTEN, UNTIL, UPDATE, USAGE, UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UNLISTEN, UNTIL, UPDATE, USAGE,
USER, USING, USER, USING,
VACUUM, VALID, VALUES, VARCHAR, VARYING, VERBOSE, VERSION, VIEW, VOLATILE, VACUUM, VALID, VALIDATOR, VALUES, VARCHAR, VARYING, VERBOSE, VERSION, VIEW, VOLATILE,
WHEN, WHERE, WITH, WITHOUT, WORK, WHEN, WHERE, WITH, WITHOUT, WORK, WRITE
YEAR_P, YEAR_P,
ZONE ZONE
...@@ -264,7 +265,7 @@ make_name(void) ...@@ -264,7 +265,7 @@ make_name(void)
%right NOT %right NOT
%right '=' %right '='
%nonassoc '<' '>' %nonassoc '<' '>'
%nonassoc LIKE ILIKE %nonassoc LIKE ILIKE SIMILAR
%nonassoc ESCAPE %nonassoc ESCAPE
%nonassoc OVERLAPS %nonassoc OVERLAPS
%nonassoc BETWEEN %nonassoc BETWEEN
...@@ -282,6 +283,7 @@ make_name(void) ...@@ -282,6 +283,7 @@ make_name(void)
%right UMINUS %right UMINUS
%left '[' ']' %left '[' ']'
%left '(' ')' %left '(' ')'
%left COLLATE
%left TYPECAST %left TYPECAST
%left '.' %left '.'
...@@ -294,46 +296,46 @@ make_name(void) ...@@ -294,46 +296,46 @@ make_name(void)
%type <str> ConstraintElem key_actions ColQualList type_name DropSchemaStmt %type <str> ConstraintElem key_actions ColQualList type_name DropSchemaStmt
%type <str> target_list target_el update_target_list alias_clause %type <str> target_list target_el update_target_list alias_clause
%type <str> update_target_el opt_id qualified_name database_name %type <str> update_target_el opt_id qualified_name database_name
%type <str> access_method attr_name index_name name func_name %type <str> access_method attr_name index_name name func_name opt_mode
%type <str> file_name AexprConst c_expr ConstTypename var_list %type <str> file_name AexprConst c_expr ConstTypename var_list copy_from
%type <str> in_expr_nodes a_expr b_expr TruncateStmt CommentStmt %type <str> in_expr_nodes a_expr b_expr TruncateStmt CommentStmt
%type <str> opt_indirection expr_list extract_list extract_arg %type <str> opt_indirection expr_list extract_list extract_arg copy_opt_item
%type <str> position_list substr_list substr_from alter_column_default %type <str> position_list substr_list substr_from alter_column_default
%type <str> trim_list in_expr substr_for attrs drop_behavior %type <str> trim_list in_expr substr_for attrs drop_behavior TableLikeClause
%type <str> Typename SimpleTypename Generic Numeric opt_float opt_numeric %type <str> Typename SimpleTypename Generic Numeric opt_float opt_numeric
%type <str> opt_decimal Character character opt_varying opt_charset %type <str> opt_decimal Character character opt_varying opt_charset
%type <str> opt_collate opt_timezone opt_interval table_ref %type <str> opt_collate opt_timezone opt_interval table_ref copy_opt_list
%type <str> row_expr row_descriptor row_list ConstDatetime opt_chain %type <str> row_expr row_descriptor row_list ConstDatetime opt_chain
%type <str> SelectStmt into_clause OptTemp ConstraintAttributeSpec %type <str> SelectStmt into_clause OptTemp ConstraintAttributeSpec
%type <str> opt_table opt_all sort_clause sortby_list ConstraintAttr %type <str> opt_table opt_all sort_clause sortby_list ConstraintAttr
%type <str> sortby OptUseOp qualified_name_list name_list ColId_or_Sconst %type <str> sortby OptUseOp qualified_name_list name_list ColId_or_Sconst
%type <str> group_clause having_clause from_clause opt_distinct %type <str> group_clause having_clause from_clause opt_distinct opt_oids
%type <str> join_outer where_clause relation_expr sub_type opt_arg %type <str> join_outer where_clause relation_expr sub_type opt_arg
%type <str> opt_column_list insert_rest InsertStmt OptimizableStmt %type <str> opt_column_list insert_rest InsertStmt OptimizableStmt
%type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt %type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt
%type <str> NotifyStmt columnElem copy_dirn UnlistenStmt copy_null %type <str> NotifyStmt columnElem UnlistenStmt
%type <str> copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary %type <str> copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary
%type <str> opt_with_copy FetchStmt direction fetch_how_many from_in %type <str> FetchStmt direction fetch_how_many from_in
%type <str> ClosePortalStmt DropStmt VacuumStmt AnalyzeStmt opt_verbose %type <str> ClosePortalStmt DropStmt VacuumStmt AnalyzeStmt opt_verbose
%type <str> opt_full func_arg OptWithOids opt_freeze opt_ecpg_into %type <str> opt_full func_arg OptWithOids opt_freeze opt_ecpg_into
%type <str> analyze_keyword opt_name_list ExplainStmt index_params %type <str> analyze_keyword opt_name_list ExplainStmt index_params
%type <str> index_list func_index index_elem opt_class access_method_clause %type <str> index_list func_index index_elem opt_class access_method_clause
%type <str> index_opt_unique IndexStmt func_return ConstInterval %type <str> index_opt_unique IndexStmt func_return ConstInterval
%type <str> func_args_list func_args opt_with def_arg %type <str> func_args_list func_args opt_with def_arg add_drop overlay_list
%type <str> def_elem def_list definition DefineStmt select_with_parens %type <str> def_elem def_list definition DefineStmt select_with_parens
%type <str> opt_instead event RuleActionList opt_using CreateAssertStmt %type <str> opt_instead event RuleActionList opt_using CreateAssertStmt
%type <str> RuleActionStmtOrEmpty RuleActionMulti func_as reindex_type %type <str> RuleActionStmtOrEmpty RuleActionMulti func_as reindex_type
%type <str> RuleStmt opt_column opt_name oper_argtypes NumConst %type <str> RuleStmt opt_column opt_name oper_argtypes NumConst
%type <str> MathOp RemoveFuncStmt aggr_argtype for_update_clause %type <str> MathOp RemoveFuncStmt aggr_argtype for_update_clause
%type <str> RemoveAggrStmt opt_procedural select_no_parens %type <str> RemoveAggrStmt opt_procedural select_no_parens opt_validator
%type <str> RemoveOperStmt RenameStmt all_Op opt_Trusted opt_lancompiler %type <str> RemoveOperStmt RenameStmt all_Op opt_trusted opt_lancompiler
%type <str> VariableSetStmt var_value zone_value VariableShowStmt %type <str> VariableSetStmt var_value zone_value VariableShowStmt
%type <str> VariableResetStmt AlterTableStmt from_list %type <str> VariableResetStmt AlterTableStmt from_list overlay_placing
%type <str> opt_trans user_list OptUserList OptUserElem relation_name %type <str> opt_trans user_list OptUserList OptUserElem relation_name
%type <str> CreateUserStmt AlterUserStmt CreateSeqStmt OptSeqList %type <str> CreateUserStmt AlterUserStmt CreateSeqStmt OptSeqList
%type <str> OptSeqElem TriggerForSpec TriggerForOpt TriggerForType %type <str> OptSeqElem TriggerForSpec TriggerForOpt TriggerForType
%type <str> DropTrigStmt TriggerOneEvent TriggerEvents RuleActionStmt %type <str> DropTrigStmt TriggerOneEvent TriggerEvents RuleActionStmt
%type <str> TriggerActionTime CreateTrigStmt DropPLangStmt %type <str> TriggerActionTime CreateTrigStmt DropPLangStmt opt_assignment
%type <str> CreatePLangStmt TriggerFuncArgs TriggerFuncArg simple_select %type <str> CreatePLangStmt TriggerFuncArgs TriggerFuncArg simple_select
%type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_item %type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_item
%type <str> createdb_opt_list opt_encoding OptInherit opt_equal %type <str> createdb_opt_list opt_encoding OptInherit opt_equal
...@@ -350,7 +352,7 @@ make_name(void) ...@@ -350,7 +352,7 @@ make_name(void)
%type <str> join_qual update_list AlterSchemaStmt joined_table %type <str> join_qual update_list AlterSchemaStmt joined_table
%type <str> opt_level opt_lock lock_type OptGroupList OptGroupElem %type <str> opt_level opt_lock lock_type OptGroupList OptGroupElem
%type <str> OptConstrFromTable OptTempTableName StringConst %type <str> OptConstrFromTable OptTempTableName StringConst
%type <str> constraints_set_mode comment_type opt_empty_parentheses %type <str> constraints_set_mode comment_type opt_definition
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete %type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
%type <str> opt_force key_update CreateSchemaStmt PosIntStringConst %type <str> opt_force key_update CreateSchemaStmt PosIntStringConst
%type <str> IntConst PosIntConst grantee_list func_type opt_or_replace %type <str> IntConst PosIntConst grantee_list func_type opt_or_replace
...@@ -379,7 +381,7 @@ make_name(void) ...@@ -379,7 +381,7 @@ make_name(void)
%type <str> struct_type s_struct vt_declarations variable_declarations %type <str> struct_type s_struct vt_declarations variable_declarations
%type <str> var_declaration type_declaration %type <str> var_declaration type_declaration
%type <str> s_union union_type ECPGSetAutocommit on_off %type <str> s_union union_type ECPGSetAutocommit on_off
%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol %type <str> ECPGAllocateDescr ECPGDeallocateDescr opt_symbol
%type <str> ECPGGetDescriptorHeader ECPGColLabel %type <str> ECPGGetDescriptorHeader ECPGColLabel
%type <str> reserved_keyword unreserved_keyword %type <str> reserved_keyword unreserved_keyword
%type <str> col_name_keyword func_name_keyword %type <str> col_name_keyword func_name_keyword
...@@ -398,8 +400,6 @@ make_name(void) ...@@ -398,8 +400,6 @@ make_name(void)
%type <index> opt_array_bounds opt_type_array_bounds %type <index> opt_array_bounds opt_type_array_bounds
%type <ival> Iresult %type <ival> Iresult
%token YYERROR_VERBOSE
%% %%
prog: statements; prog: statements;
...@@ -659,12 +659,14 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); } ...@@ -659,12 +659,14 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
* *
*****************************************************************************/ *****************************************************************************/
CreateUserStmt: CREATE USER UserId OptUserList CreateUserStmt: CREATE USER UserId opt_with OptUserList
{ $$ = cat_str(3, make_str("create user"), $3, $4); } { $$ = cat_str(4, make_str("create user"), $3, $4, $5); }
| CREATE USER UserId WITH OptUserList
{ $$ = cat_str(4, make_str("create user"), $3, make_str("with"), $5); }
; ;
opt_with: WITH { $$ = make_str("with"); }
| /* EMPTY */ { $$ = EMPTY; }
;
/***************************************************************************** /*****************************************************************************
* *
* Alter a postgresql DBMS user * Alter a postgresql DBMS user
...@@ -672,10 +674,8 @@ CreateUserStmt: CREATE USER UserId OptUserList ...@@ -672,10 +674,8 @@ CreateUserStmt: CREATE USER UserId OptUserList
* *
*****************************************************************************/ *****************************************************************************/
AlterUserStmt: ALTER USER UserId OptUserList AlterUserStmt: ALTER USER UserId opt_with OptUserList
{ $$ = cat_str(3, make_str("alter user"), $3, $4); } { $$ = cat_str(4, make_str("alter user"), $3, $4, $5); }
| ALTER USER UserId WITH OptUserList
{ $$ = cat_str(4, make_str("alter user"), $3, make_str("with"), $5); }
; ;
AlterUserSetStmt: ALTER USER UserId SET set_rest AlterUserSetStmt: ALTER USER UserId SET set_rest
...@@ -702,7 +702,11 @@ OptUserList: OptUserList OptUserElem { $$ = cat2_str($1, $2); } ...@@ -702,7 +702,11 @@ OptUserList: OptUserList OptUserElem { $$ = cat2_str($1, $2); }
; ;
OptUserElem: PASSWORD Sconst OptUserElem: PASSWORD Sconst
{ $$ = cat2_str(make_str("password"), $2); } { $$ = cat2_str(make_str("password"), $2); }
| ENCRYPTED PASSWORD Sconst
{ $$ = cat2_str(make_str("encrypted password"), $3); }
| UNENCRYPTED PASSWORD Sconst
{ $$ = cat2_str(make_str("unencrypted password"), $3); }
| SYSID Iconst | SYSID Iconst
{ $$ = cat2_str(make_str("sysid"), $2); } { $$ = cat2_str(make_str("sysid"), $2); }
| CREATEDB | CREATEDB
...@@ -731,10 +735,8 @@ user_list: user_list ',' UserId ...@@ -731,10 +735,8 @@ user_list: user_list ',' UserId
* *
* *
****************************************************************************/ ****************************************************************************/
CreateGroupStmt: CREATE GROUP_P UserId OptGroupList CreateGroupStmt: CREATE GROUP_P UserId opt_with OptGroupList
{ $$ = cat_str(3, make_str("create group"), $3, $4); } { $$ = cat_str(4, make_str("create group"), $3, $4, $5); }
| CREATE GROUP_P UserId WITH OptGroupList
{ $$ = cat_str(4, make_str("create group"), $3, make_str("with"), $5); }
; ;
/* /*
...@@ -757,12 +759,14 @@ OptGroupElem: USER user_list ...@@ -757,12 +759,14 @@ OptGroupElem: USER user_list
* *
* *
*****************************************************************************/ *****************************************************************************/
AlterGroupStmt: ALTER GROUP_P UserId ADD USER user_list AlterGroupStmt: ALTER GROUP_P UserId add_drop USER user_list
{ $$ = cat_str(4, make_str("alter group"), $3, make_str("add user"), $6); } { $$ = cat_str(4, make_str("alter group"), $3, $4, make_str("user"), $6); }
| ALTER GROUP_P UserId DROP USER user_list
{ $$ = cat_str(4, make_str("alter group"), $3, make_str("drop user"), $6); }
; ;
add_drop: ADD { $$ = make_str("add"); }
| DROP { $$ = make_str("drop"); }
;
/***************************************************************************** /*****************************************************************************
* *
* Drop a postgresql group * Drop a postgresql group
...@@ -835,8 +839,8 @@ set_rest: ColId TO var_list_or_default ...@@ -835,8 +839,8 @@ set_rest: ColId TO var_list_or_default
{ $$ = cat_str(3, $1, make_str("="), $3); } { $$ = cat_str(3, $1, make_str("="), $3); }
| TIME ZONE zone_value | TIME ZONE zone_value
{ $$ = cat2_str(make_str("time zone"), $3); } { $$ = cat2_str(make_str("time zone"), $3); }
| TRANSACTION ISOLATION LEVEL opt_level | TRANSACTION ISOLATION LEVEL opt_level opt_mode
{ $$ = cat2_str(make_str("transaction isolation level"), $4); } { $$ = cat_str(3, make_str("transaction isolation level"), $4, $5); }
| SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL opt_level | SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL opt_level
{ $$ = cat2_str(make_str("session characteristics as transaction isolation level"), $7); } { $$ = cat2_str(make_str("session characteristics as transaction isolation level"), $7); }
| NAMES opt_encoding | NAMES opt_encoding
...@@ -863,6 +867,13 @@ opt_level: READ COMMITTED { $$ = make_str("read committed"); } ...@@ -863,6 +867,13 @@ opt_level: READ COMMITTED { $$ = make_str("read committed"); }
| SERIALIZABLE { $$ = make_str("serializable"); } | SERIALIZABLE { $$ = make_str("serializable"); }
; ;
opt_mode: READ WRITE { $$ = make_str("read write"); }
| READ ONLY {
mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported SET TRANSACTION/READ ONLY will be passed to backend");
$$ = make_str("read copy");
}
| /* EMPTY */ { $$ = EMPTY; }
;
var_value: opt_boolean { $$ = $1; } var_value: opt_boolean { $$ = $1; }
| AllConst { $$ = $1; } | AllConst { $$ = $1; }
...@@ -1021,16 +1032,19 @@ opt_id: ColId { $$ = $1; } ...@@ -1021,16 +1032,19 @@ opt_id: ColId { $$ = $1; }
/***************************************************************************** /*****************************************************************************
* *
* QUERY : * QUERY :
* COPY [BINARY] <relname> FROM/TO * COPY <relname> FROM/TO [WITH options]
* [USING DELIMITERS <delimiter>] *
* BINARY, OIDS, and DELIMITERS kept in old locations
* for backward compatibility. 2002-06-18
* *
*****************************************************************************/ *****************************************************************************/
CopyStmt: COPY opt_binary qualified_name opt_with_copy copy_dirn copy_file_name copy_delimiter copy_null CopyStmt: COPY opt_binary qualified_name opt_oids copy_from
{ $$ = cat_str(8, make_str("copy"), $2, $3, $4, $5, $6, $7, $8); } copy_file_name copy_delimiter opt_with copy_opt_list
{ $$ = cat_str(9, make_str("copy"), $2, $3, $4, $5, $6, $7, $8i, $9); }
; ;
copy_dirn: TO { $$ = make_str("to"); } copy_from: TO { $$ = make_str("to"); }
| FROM { $$ = make_str("from"); } | FROM { $$ = make_str("from"); }
; ;
...@@ -1043,18 +1057,24 @@ copy_file_name: StringConst { $$ = $1; } ...@@ -1043,18 +1057,24 @@ copy_file_name: StringConst { $$ = $1; }
| STDIN { $$ = make_str("stdin"); } | STDIN { $$ = make_str("stdin"); }
| STDOUT { $$ = make_str("stdout"); } | STDOUT { $$ = make_str("stdout"); }
; ;
opt_binary: BINARY { $$ = make_str("binary"); } copy_opt_list: copy_opt_list copy_opt_item { $$ = cat2_str($1, $2); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
;
copy_opt_item: BINARY { $$ = make_str("binary"); }
| OIDS { $$ = make_str("oids"); }
| DELIMITER opt_as Sconst { $$ = cat_str(3, make_str("delimiter"), $2, $3); }
| NULL_P opt_as Sconst { $$ = cat_str(3, make_str("null"), $2, $3); }
; ;
opt_with_copy: WITH OIDS { $$ = make_str("with oids"); } opt_binary: BINARY { $$ = make_str("binary"); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
;
opt_oids: WITH OIDS { $$ = make_str("with oids"); }
| /*EMPTY*/ { $$ = EMPTY; }
; ;
/*
* the default copy delimiter is tab but the user can configure it
*/
copy_delimiter: opt_using DELIMITERS StringConst copy_delimiter: opt_using DELIMITERS StringConst
{ $$ = cat_str(3, $1, make_str("delimiters"), $3); } { $$ = cat_str(3, $1, make_str("delimiters"), $3); }
| /*EMPTY*/ | /*EMPTY*/
...@@ -1065,12 +1085,6 @@ opt_using: USING { $$ = make_str("using"); } ...@@ -1065,12 +1085,6 @@ opt_using: USING { $$ = make_str("using"); }
| /* EMPTY */ { $$ = EMPTY; } | /* EMPTY */ { $$ = EMPTY; }
; ;
copy_null: WITH NULL_P AS StringConst
{ $$ = cat2_str(make_str("with null as"), $4); }
| /* EMPTY */
{ $$ = EMPTY; }
;
/***************************************************************************** /*****************************************************************************
* *
* QUERY : * QUERY :
...@@ -1114,6 +1128,7 @@ OptTableElementList: OptTableElementList ',' OptTableElement ...@@ -1114,6 +1128,7 @@ OptTableElementList: OptTableElementList ',' OptTableElement
; ;
OptTableElement: columnDef { $$ = $1; } OptTableElement: columnDef { $$ = $1; }
| TableLikeClause { $$ = $1; }
| TableConstraint { $$ = $1; } | TableConstraint { $$ = $1; }
; ;
...@@ -1182,6 +1197,9 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); } ...@@ -1182,6 +1197,9 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); }
| INITIALLY IMMEDIATE { $$ = make_str("initially immediate"); } | INITIALLY IMMEDIATE { $$ = make_str("initially immediate"); }
; ;
TableLikeClause: LIKE any_name { $$ = cat2_str(make_str("like"), $2); }
;
/* ConstraintElem specifies constraint syntax which is not embedded into /* ConstraintElem specifies constraint syntax which is not embedded into
* a column definition. ColConstraintElem specifies the embedded form. * a column definition. ColConstraintElem specifies the embedded form.
* - thomas 1997-12-03 * - thomas 1997-12-03
...@@ -1223,6 +1241,8 @@ key_match: MATCH FULL ...@@ -1223,6 +1241,8 @@ key_match: MATCH FULL
mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported FOREIGN KEY/MATCH PARTIAL will be passed to backend"); mmerror(PARSE_ERROR, ET_WARNING, "Currently unsupported FOREIGN KEY/MATCH PARTIAL will be passed to backend");
$$ = make_str("match partial"); $$ = make_str("match partial");
} }
| MATCH SIMPLE
{ $$ = make_str("match simple"); }
| /*EMPTY*/ | /*EMPTY*/
{ $$ = EMPTY; } { $$ = EMPTY; }
; ;
...@@ -1329,12 +1349,12 @@ OptSeqElem: CACHE NumConst ...@@ -1329,12 +1349,12 @@ OptSeqElem: CACHE NumConst
* *
*****************************************************************************/ *****************************************************************************/
CreatePLangStmt: CREATE opt_Trusted opt_procedural LANGUAGE ColId_or_Sconst CreatePLangStmt: CREATE opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
HANDLER handler_name opt_lancompiler HANDLER handler_name opt_validator opt_lancompiler
{ $$ = cat_str(8, make_str("create"), $2, $3, make_str("language"), $5, make_str("handler"), $7, $8); } { $$ = cat_str(8, make_str("create"), $2, $3, make_str("language"), $5, make_str("handler"), $7, $8); }
; ;
opt_Trusted: TRUSTED { $$ = make_str("trusted"); } opt_trusted: TRUSTED { $$ = make_str("trusted"); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
...@@ -1354,6 +1374,10 @@ opt_lancompiler: LANCOMPILER StringConst ...@@ -1354,6 +1374,10 @@ opt_lancompiler: LANCOMPILER StringConst
{ $$ = ""; } { $$ = ""; }
; ;
opt_validator: VALIDATOR handler_name { $$ = cat2_str(make_str("validator"), $2); }
| /* EMPTY */ { $$ = EMPTY; }
;
DropPLangStmt: DROP opt_procedural LANGUAGE StringConst DropPLangStmt: DROP opt_procedural LANGUAGE StringConst
{ $$ = cat_str(4, make_str("drop"), $2, make_str("language"), $4); } { $$ = cat_str(4, make_str("drop"), $2, make_str("language"), $4); }
; ;
...@@ -1444,6 +1468,7 @@ ConstraintAttributeSpec: ConstraintDeferrabilitySpec { $$ = $1; } ...@@ -1444,6 +1468,7 @@ ConstraintAttributeSpec: ConstraintDeferrabilitySpec { $$ = $1; }
$$ = cat2_str($1, $2); $$ = cat2_str($1, $2);
} }
| /*EMPTY*/ { $$ = EMPTY; }
; ;
ConstraintDeferrabilitySpec: NOT DEFERRABLE ConstraintDeferrabilitySpec: NOT DEFERRABLE
...@@ -1819,18 +1844,32 @@ RecipeStmt: EXECUTE RECIPE recipe_name ...@@ -1819,18 +1844,32 @@ RecipeStmt: EXECUTE RECIPE recipe_name
*****************************************************************************/ *****************************************************************************/
CreateFunctionStmt: CREATE opt_or_replace FUNCTION func_name func_args CreateFunctionStmt: CREATE opt_or_replace FUNCTION func_name func_args
RETURNS func_return createfunc_opt_list opt_with RETURNS func_return createfunc_opt_list opt_definition
{ $$ = cat_str(8, make_str("create"), $2, make_str("function"), $4, $5, make_str("returns"), $7, $8); } { $$ = cat_str(8, make_str("create"), $2, make_str("function"), $4, $5, make_str("returns"), $7, $8); }
| CREATE opt_or_replace CAST '(' func_type AS func_type ')'
WITH FUNCTION func_name func_args opt_assignment opt_definition
{ $$ = cat_str(11, make_str("create"), $2, make_str("cast ("), $5, make_str("as"), $7, make_str(") with function"), $11, $12, $13, $14); }
| CREATE opt_or_replace CAST '(' func_type AS func_type ')'
WITH FUNCTION func_name func_args AS Sconst opt_definition
{ $$ = cat_str(12, make_str("create"), $2, make_str("cast ("), $5, make_str("as"), $7, make_str(") with function"), $11, $12, make_str("as)", $14, $15); }
| CREATE opt_or_replace CAST '(' func_type AS func_type ')'
createfunc_opt_list opt_definition
{ $$ = cat_str(i9, make_str("create"), $2, make_str("cast ("), $5, make_str("as"), $7, make_str(")"), $9, $10); }
; ;
opt_or_replace: OR REPLACE { $$ = make_str("or replace"); } opt_or_replace: OR REPLACE { $$ = make_str("or replace"); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
opt_with: WITH definition { $$ = cat2_str(make_str("with"), $2); } opt_definition: WITH definition { $$ = cat2_str(make_str("with"), $2); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
opt_assignment: AS ASSIGNMENT { $$ = make_str("as assignment"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
func_args: '(' func_args_list ')' func_args: '(' func_args_list ')'
{ $$ = cat_str(3, make_str("("), $2, make_str(")")); } { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
| '(' ')' | '(' ')'
...@@ -1936,8 +1975,16 @@ createfunc_opt_item: AS func_as ...@@ -1936,8 +1975,16 @@ createfunc_opt_item: AS func_as
* *
*****************************************************************************/ *****************************************************************************/
RemoveFuncStmt: DROP FUNCTION func_name func_args RemoveFuncStmt: DROP FUNCTION func_name func_args opt_drop_behavior
{ $$ = cat_str(3, make_str("drop function"), $3, $4); } {
if (strcmp($5, "restrict") != 0)
mmerror(PARSE_ERROR, ET_WARNING, "Unsupported DROP FUNCTION/CASCADE will be passed to backend");
$$ = cat_str(4, make_str("drop function"), $3, $4, $5);
}
| DROP CAST '(' func_type AS func_type ')' opt_drop_behavior
{
$$ = cat_str(6, make_str("drop cast ("), $4, make_Str("as"), $6, make_str(")", $8);
}
; ;
RemoveAggrStmt: DROP AGGREGATE func_name '(' aggr_argtype ')' RemoveAggrStmt: DROP AGGREGATE func_name '(' aggr_argtype ')'
...@@ -2147,16 +2194,14 @@ LoadStmt: LOAD file_name ...@@ -2147,16 +2194,14 @@ LoadStmt: LOAD file_name
* *
*****************************************************************************/ *****************************************************************************/
CreatedbStmt: CREATE DATABASE database_name WITH createdb_opt_list CreatedbStmt: CREATE DATABASE database_name opt_with createdb_opt_list
{ $$ = cat_str(4, make_str("create database"), $3, make_str("with"), $5); } { $$ = cat_str(4, make_str("create database"), $3, $4, $5); }
| CREATE DATABASE database_name
{ $$ = cat2_str(make_str("create database"), $3); }
; ;
createdb_opt_list: createdb_opt_item createdb_opt_list: createdb_opt_list createdb_opt_item
{ $$ = $1; }
| createdb_opt_list createdb_opt_item
{ $$ = cat2_str($1, $2); } { $$ = cat2_str($1, $2); }
| /* EMPTY */
{ $$ = EMPTY; }
; ;
createdb_opt_item: LOCATION opt_equal StringConst createdb_opt_item: LOCATION opt_equal StringConst
...@@ -3038,6 +3083,8 @@ a_expr: c_expr ...@@ -3038,6 +3083,8 @@ a_expr: c_expr
{ $$ = $1; } { $$ = $1; }
| a_expr TYPECAST Typename | a_expr TYPECAST Typename
{ $$ = cat_str(3, $1, make_str("::"), $3); } { $$ = cat_str(3, $1, make_str("::"), $3); }
| a_expr COLLATE Typename
{ $$ = cat_str(3, $1, make_str("collate"), $3); }
| a_expr AT TIME ZONE c_expr | a_expr AT TIME ZONE c_expr
{ $$ = cat_str(3, $1, make_str("at time zone"), $5); } { $$ = cat_str(3, $1, make_str("at time zone"), $5); }
/* /*
...@@ -3107,6 +3154,14 @@ a_expr: c_expr ...@@ -3107,6 +3154,14 @@ a_expr: c_expr
{ $$ = cat_str(3, $1, make_str("not ilike"), $4); } { $$ = cat_str(3, $1, make_str("not ilike"), $4); }
| a_expr NOT ILIKE a_expr ESCAPE a_expr | a_expr NOT ILIKE a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("not ilike"), $4, make_str("escape"), $6); } { $$ = cat_str(5, $1, make_str("not ilike"), $4, make_str("escape"), $6); }
| a_expr SIMILAR TO a_expr %prec SIMILAR
{ $$ = cat_str(3, $1, make_str("similar to"), $4); }
| a_expr SIMILAR TO a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("similar to"), $4, make_str("escape"), $6); }
| a_expr NOT SIMILAR TO a_expr %prec SIMILAR
{ $$ = cat_str(3, $1, make_str("not similar to"), $5); }
| a_expr NOT SIMILAR TO a_expr ESCAPE a_expr
{ $$ = cat_str(5, $1, make_str("not similar to"), $5, make_str("escape"), $7); }
| a_expr ISNULL | a_expr ISNULL
{ $$ = cat2_str($1, make_str("isnull")); } { $$ = cat2_str($1, make_str("isnull")); }
| a_expr IS NULL_P | a_expr IS NULL_P
...@@ -3232,22 +3287,32 @@ c_expr: columnref ...@@ -3232,22 +3287,32 @@ c_expr: columnref
{ $$ = cat2_str($1, make_str("(*)")); } { $$ = cat2_str($1, make_str("(*)")); }
| CURRENT_DATE | CURRENT_DATE
{ $$ = make_str("current_date"); } { $$ = make_str("current_date"); }
| CURRENT_TIME opt_empty_parentheses | CURRENT_TIME
{ $$ = cat2_str(make_str("current_time"), $2); } { $$ = make_str("current_time"); }
| CURRENT_TIME '(' PosIntConst ')' | CURRENT_TIME '(' PosIntConst ')'
{ $$ = make_str("current_time"); } { $$ = make_str("current_time"); }
| CURRENT_TIMESTAMP opt_empty_parentheses | CURRENT_TIMESTAMP
{ $$ = cat2_str(make_str("current_timestamp"), $2); } { $$ = make_str("current_timestamp"); }
| CURRENT_TIMESTAMP '(' PosIntConst ')' | CURRENT_TIMESTAMP '(' PosIntConst ')'
{ $$ = make_str("current_timestamp"); } { $$ = make_str("current_timestamp"); }
| CURRENT_USER opt_empty_parentheses | LOCALTIME
{ $$ = cat2_str(make_str("current_user"), $2); } { $$ = make_str("localtime"); }
| SESSION_USER opt_empty_parentheses | LOCALTIME '(' Iconst ')'
{ $$ = cat2_str(make_str("session_user"), $2); } { $$ = cat_str(3, make_str("localtime ("), $3, make_str(")")); }
| USER opt_empty_parentheses | LOCALTIMESTAMP
{ $$ = cat2_str(make_str("user"), $2); } { $$ = make_str("localtimestamp"); }
| LOCALTIMESTAMP '(' Iconst ')'
{ $$ = cat_str(3, make_str("localtime ("), $3, make_str(")")); }
| CURRENT_USER
{ $$ = make_str("current_user"); }
| SESSION_USER
{ $$ = make_str("session_user"); }
| USER
{ $$ = make_str("user"); }
| EXTRACT '(' extract_list ')' | EXTRACT '(' extract_list ')'
{ $$ = cat_str(3, make_str("extract("), $3, make_str(")")); } { $$ = cat_str(3, make_str("extract("), $3, make_str(")")); }
| OVERLAY '(' overlay_list ')'
{ $$ = cat_str(3, make_str("overlay("), $3, make_str(")")); }
| POSITION '(' position_list ')' | POSITION '(' position_list ')'
{ $$ = cat_str(3, make_str("position("), $3, make_str(")")); } { $$ = cat_str(3, make_str("position("), $3, make_str(")")); }
| SUBSTRING '(' substr_list ')' | SUBSTRING '(' substr_list ')'
...@@ -3306,6 +3371,15 @@ extract_arg: IDENT { $$ = $1; } ...@@ -3306,6 +3371,15 @@ extract_arg: IDENT { $$ = $1; }
| StringConst { $$ = $1; } | StringConst { $$ = $1; }
; ;
overlay_list: a_expr overlay_placing substr_from substr_for
{ $$ = cat_str(4, $1, $2, $3, $4); }
| a_expr overlay_placing substr_from
{ $$ = cat_str(3, $1, $2, $3); }
;
overlay_placing: PLACING a_expr { $$ = cat2_str(make_str("placing"), $2); }
;
/* position_list uses b_expr not a_expr to avoid conflict with general IN */ /* position_list uses b_expr not a_expr to avoid conflict with general IN */
position_list: b_expr IN_P b_expr position_list: b_expr IN_P b_expr
{ $$ = cat_str(3, $1, make_str("in"), $3); } { $$ = cat_str(3, $1, make_str("in"), $3); }
...@@ -3416,11 +3490,6 @@ attrs: '.' attr_name ...@@ -3416,11 +3490,6 @@ attrs: '.' attr_name
{ $$ = cat_str(3, make_str("."), $2, $3); } { $$ = cat_str(3, make_str("."), $2, $3); }
; ;
opt_empty_parentheses: '(' ')' { $$ = make_str("()"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
/***************************************************************************** /*****************************************************************************
* *
* target lists * target lists
...@@ -4077,7 +4146,7 @@ type: simple_type ...@@ -4077,7 +4146,7 @@ type: simple_type
enum_type: SQL_ENUM opt_symbol enum_definition enum_type: SQL_ENUM opt_symbol enum_definition
{ $$ = cat_str(3, make_str("enum"), $2, $3); } { $$ = cat_str(3, make_str("enum"), $2, $3); }
| SQL_ENUM symbol | SQL_ENUM ColLabel
{ $$ = cat2_str(make_str("enum"), $2); } { $$ = cat2_str(make_str("enum"), $2); }
; ;
...@@ -4799,13 +4868,10 @@ ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); } ...@@ -4799,13 +4868,10 @@ ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); }
| SQL_UNSIGNED { $$ = make_str("unsigned"); } | SQL_UNSIGNED { $$ = make_str("unsigned"); }
; ;
opt_symbol: symbol { $$ = $1; } opt_symbol: ColLabel
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
symbol: ColLabel { $$ = $1; }
;
/* /*
* Name classification hierarchy. * Name classification hierarchy.
* *
...@@ -4881,7 +4947,8 @@ unreserved_keyword: ...@@ -4881,7 +4947,8 @@ unreserved_keyword:
| AFTER { $$ = make_str("after"); } | AFTER { $$ = make_str("after"); }
| AGGREGATE { $$ = make_str("aggregate"); } | AGGREGATE { $$ = make_str("aggregate"); }
| ALTER { $$ = make_str("alter"); } | ALTER { $$ = make_str("alter"); }
| ASSERTION { $$ = make_str("assertion"); } | ASSERTION { $$ = make_str("assertion"); }
| ASSIGNMENT { $$ = make_str("assignment"); }
| AT { $$ = make_str("at"); } | AT { $$ = make_str("at"); }
| BACKWARD { $$ = make_str("backward"); } | BACKWARD { $$ = make_str("backward"); }
| BEFORE { $$ = make_str("before"); } | BEFORE { $$ = make_str("before"); }
...@@ -4908,6 +4975,7 @@ unreserved_keyword: ...@@ -4908,6 +4975,7 @@ unreserved_keyword:
| DECLARE { $$ = make_str("declare"); } | DECLARE { $$ = make_str("declare"); }
| DEFERRED { $$ = make_str("deferred"); } | DEFERRED { $$ = make_str("deferred"); }
| DELETE_P { $$ = make_str("delete"); } | DELETE_P { $$ = make_str("delete"); }
| DELIMITER { $$ = make_str("delimiter"); }
| DELIMITERS { $$ = make_str("delimiters"); } | DELIMITERS { $$ = make_str("delimiters"); }
| DOMAIN_P { $$ = make_str("domain"); } | DOMAIN_P { $$ = make_str("domain"); }
| DOUBLE { $$ = make_str("double"); } | DOUBLE { $$ = make_str("double"); }
...@@ -4923,6 +4991,7 @@ unreserved_keyword: ...@@ -4923,6 +4991,7 @@ unreserved_keyword:
| FORCE { $$ = make_str("force"); } | FORCE { $$ = make_str("force"); }
| FORWARD { $$ = make_str("forward"); } | FORWARD { $$ = make_str("forward"); }
| FUNCTION { $$ = make_str("function"); } | FUNCTION { $$ = make_str("function"); }
| GET { $$ = make_str("get"); }
| GLOBAL { $$ = make_str("global"); } | GLOBAL { $$ = make_str("global"); }
| HANDLER { $$ = make_str("handler"); } | HANDLER { $$ = make_str("handler"); }
| HOUR_P { $$ = make_str("hour"); } | HOUR_P { $$ = make_str("hour"); }
...@@ -4995,6 +5064,8 @@ unreserved_keyword: ...@@ -4995,6 +5064,8 @@ unreserved_keyword:
| SET { $$ = make_str("set"); } | SET { $$ = make_str("set"); }
| SHARE { $$ = make_str("share"); } | SHARE { $$ = make_str("share"); }
| SHOW { $$ = make_str("show"); } | SHOW { $$ = make_str("show"); }
| SIMPLE { $$ = make_str("simple"); }
| STABLE { $$ = make_str("stable"); }
| START { $$ = make_str("start"); } | START { $$ = make_str("start"); }
| STATEMENT { $$ = make_str("statement"); } | STATEMENT { $$ = make_str("statement"); }
| STATISTICS { $$ = make_str("statistics"); } | STATISTICS { $$ = make_str("statistics"); }
...@@ -5019,12 +5090,14 @@ unreserved_keyword: ...@@ -5019,12 +5090,14 @@ unreserved_keyword:
| USAGE { $$ = make_str("usage"); } | USAGE { $$ = make_str("usage"); }
| VACUUM { $$ = make_str("vacuum"); } | VACUUM { $$ = make_str("vacuum"); }
| VALID { $$ = make_str("valid"); } | VALID { $$ = make_str("valid"); }
| VALIDATOR { $$ = make_str("validator"); }
| VALUES { $$ = make_str("values"); } | VALUES { $$ = make_str("values"); }
| VARYING { $$ = make_str("varying"); } | VARYING { $$ = make_str("varying"); }
| VERSION { $$ = make_str("version"); } | VERSION { $$ = make_str("version"); }
| VIEW { $$ = make_str("view"); } | VIEW { $$ = make_str("view"); }
| WITH { $$ = make_str("with"); } | WITH { $$ = make_str("with"); }
| WITHOUT { $$ = make_str("without"); } | WITHOUT { $$ = make_str("without"); }
| WRITE { $$ = make_str("write"); }
| WORK { $$ = make_str("work"); } | WORK { $$ = make_str("work"); }
| YEAR_P { $$ = make_str("year"); } | YEAR_P { $$ = make_str("year"); }
| ZONE { $$ = make_str("zone"); } | ZONE { $$ = make_str("zone"); }
...@@ -5062,6 +5135,7 @@ col_name_keyword: ...@@ -5062,6 +5135,7 @@ col_name_keyword:
| NONE { $$ = make_str("none"); } | NONE { $$ = make_str("none"); }
| NULLIF { $$ = make_str("nullif"); } | NULLIF { $$ = make_str("nullif"); }
| NUMERIC { $$ = make_str("numeric"); } | NUMERIC { $$ = make_str("numeric"); }
| OVERLAY { $$ = make_str("overlay"); }
| POSITION { $$ = make_str("position"); } | POSITION { $$ = make_str("position"); }
| REAL { $$ = make_str("real"); } | REAL { $$ = make_str("real"); }
| SETOF { $$ = make_str("setof"); } | SETOF { $$ = make_str("setof"); }
...@@ -5103,6 +5177,7 @@ func_name_keyword: ...@@ -5103,6 +5177,7 @@ func_name_keyword:
| OUTER_P { $$ = make_str("outer"); } | OUTER_P { $$ = make_str("outer"); }
| OVERLAPS { $$ = make_str("overlaps"); } | OVERLAPS { $$ = make_str("overlaps"); }
| RIGHT { $$ = make_str("right"); } | RIGHT { $$ = make_str("right"); }
| SIMILAR { $$ = make_str("similar"); }
| VERBOSE { $$ = make_str("verbose"); } | VERBOSE { $$ = make_str("verbose"); }
; ;
...@@ -5152,6 +5227,8 @@ reserved_keyword: ...@@ -5152,6 +5227,8 @@ reserved_keyword:
| INTO { $$ = make_str("into"); } | INTO { $$ = make_str("into"); }
| LEADING { $$ = make_str("leading"); } | LEADING { $$ = make_str("leading"); }
| LIMIT { $$ = make_str("limit"); } | LIMIT { $$ = make_str("limit"); }
| LOCALTIME { $$ = make_str("localtime"); }
| LOCALTIMESTAMP { $$ = make_str("localtimestamp"); }
| NEW { $$ = make_str("new"); } | NEW { $$ = make_str("new"); }
| NOT { $$ = make_str("not"); } | NOT { $$ = make_str("not"); }
| NULL_P { $$ = make_str("null"); } | NULL_P { $$ = make_str("null"); }
...@@ -5162,6 +5239,7 @@ reserved_keyword: ...@@ -5162,6 +5239,7 @@ reserved_keyword:
| ONLY { $$ = make_str("only"); } | ONLY { $$ = make_str("only"); }
| OR { $$ = make_str("or"); } | OR { $$ = make_str("or"); }
| ORDER { $$ = make_str("order"); } | ORDER { $$ = make_str("order"); }
| PLACING { $$ = make_str("playcing"); }
| PRIMARY { $$ = make_str("primary"); } | PRIMARY { $$ = make_str("primary"); }
| REFERENCES { $$ = make_str("references"); } | REFERENCES { $$ = make_str("references"); }
| SELECT { $$ = make_str("select"); } | SELECT { $$ = make_str("select"); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment