-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.204 2002/12/12 21:50:01 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.205 2002/12/13 20:29:07 momjian Exp $ */
/* Copyright comment */
%{
SQL_CALL SQL_CARDINALITY SQL_CONNECT SQL_CONNECTION
SQL_CONTINUE SQL_COUNT SQL_CURRENT SQL_DATA
SQL_DATETIME_INTERVAL_CODE
- SQL_DATETIME_INTERVAL_PRECISION
+ SQL_DATETIME_INTERVAL_PRECISION
SQL_DESCRIPTOR SQL_DISCONNECT SQL_ENUM SQL_FOUND
SQL_FREE SQL_GO SQL_GOTO SQL_IDENTIFIED
SQL_INDICATOR SQL_KEY_MEMBER SQL_LENGTH
ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCREMENT INDEX INHERITS
INITIALLY INNER_P INOUT INPUT INSENSITIVE INSERT INSTEAD INT
INTEGER INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
-
+
JOIN
-
+
KEY
LANCOMPILER LANGUAGE LAST LEADING LEFT LEVEL LIKE LIMIT LISTEN
%type <str> CreateAsElement OptCreateAs CreateAsList CreateAsStmt
%type <str> comment_text ConstraintDeferrabilitySpec TableElementList
%type <str> key_match ColLabel SpecialRuleRelation ColId columnDef
-%type <str> ColConstraint ColConstraintElem drop_type Bconst
-%type <str> TableConstraint OptTableElementList Xconst
+%type <str> ColConstraint ColConstraintElem drop_type Bconst
+%type <str> TableConstraint OptTableElementList Xconst
%type <str> ConstraintElem key_actions ColQualList type_name
%type <str> target_list target_el update_target_list alias_clause
%type <str> update_target_el opt_id qualified_name database_name
%type <str> trim_list in_expr substr_for attrs TableFuncElement
%type <str> Typename SimpleTypename Numeric opt_float opt_numeric
%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
%type <str> row_descriptor ConstDatetime trans_options
%type <str> SelectStmt into_clause OptTemp ConstraintAttributeSpec
%type <str> opt_table opt_all sort_clause sortby_list ConstraintAttr
%type <str> def_elem def_list definition DefineStmt select_with_parens
%type <str> opt_instead event RuleActionList opt_using CreateAssertStmt
%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> RemoveAggrStmt opt_procedural select_no_parens CreateCastStmt
%type <str> RemoveOperStmt RenameStmt all_Op opt_Trusted opt_lancompiler
%type <str> select_clause opt_select_limit select_limit_value opt_recheck
%type <str> ConstraintTimeSpec AlterDatabaseSetStmt DropAssertStmt
%type <str> select_offset_value ReindexStmt join_type opt_boolean
-%type <str> join_qual update_list joined_table opclass_item
+%type <str> join_qual update_list joined_table opclass_item
%type <str> opt_lock lock_type OptGroupList OptGroupElem
%type <str> OptConstrFromTable OptTempTableName StringConst
%type <str> constraints_set_mode comment_type opt_empty_parentheses
%type <str> createfunc_opt_item set_rest var_list_or_default
%type <str> CreateFunctionStmt createfunc_opt_list func_table
%type <str> DropUserStmt copy_from copy_opt_list opt_mode copy_opt_item
-%type <str> opt_oids TableLikeClause key_action opt_definition
+%type <str> opt_oids TableLikeClause key_action opt_definition
%type <str> cast_context row r_expr qual_Op qual_all_Op opt_default
%type <str> CreateConversionStmt any_operator opclass_item_list
%type <str> iso_level type_list CharacterWithLength ConstCharacter
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
%type <str> indicator ECPGExecute ECPGPrepare opt_ecpg_using ecpg_into
-%type <str> storage_clause opt_initializer c_anything
+%type <str> storage_clause opt_initializer c_anything
%type <str> variable_list variable c_thing c_term
%type <str> opt_pointer ECPGDisconnect dis_name storage_modifier
%type <str> stmt ECPGRelease execstring server_name
%type <str> enum_type civar civarind ECPGCursorStmt ECPGDeallocate
%type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
%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> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol
%type <str> ECPGGetDescriptorHeader ECPGColLabel
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for disconnect statement.\n");
- fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);", $1);
+ fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);",
+ $1 ? $1 : "\"CURRENT\"");
whenever_action(2);
free($1);
}
{ $$ = 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
{ $$ = cat_str(4, make_str("alter user"), $3, make_str("set"), $5); }
| ALTER USER UserId VariableResetStmt
{ $$ = cat_str(3, make_str("alter user"), $3, $4); }
{ $$ = cat2_str(make_str("valid until"), $3); }
;
-user_list: user_list ',' UserId
+user_list: user_list ',' UserId
{ $$ = cat_str(3, $1, make_str(","), $3); }
- | UserId
+ | UserId
{ $$ = $1; }
;
OptGroupElem: USER user_list
{ $$ = cat2_str(make_str("user"), $2); }
- | SYSID PosIntConst
+ | SYSID PosIntConst
{ $$ = cat2_str(make_str("sysid"), $2); }
;
{ $$ = cat2_str(make_str("names"), $2); }
| SESSION AUTHORIZATION ColId_or_Sconst
{ $$ = cat2_str(make_str("session authorization"), $3); }
- | SESSION AUTHORIZATION DEFAULT
+ | SESSION AUTHORIZATION DEFAULT
{ $$ = make_str("session authorization default"); }
;
| var_list ',' var_value
{ $$ = cat_str(3, $1, make_str(","), $3); }
;
-
+
iso_level: READ COMMITTED { $$ = make_str("read committed"); }
| SERIALIZABLE { $$ = make_str("serializable"); }
;
$$ = make_str("read only"); }
| /* EMPTY */ { $$ = EMPTY; }
;
-
+
var_value: opt_boolean { $$ = $1; }
| AllConst { $$ = $1; }
- | ColId { $$ = $1; }
+ | ColId { $$ = $1; }
;
opt_boolean: TRUE_P { $$ = make_str("true"); }
{ $$ = cat_str(3, $1, $2, $3); }
| ConstInterval '(' PosIntConst ')' StringConst opt_interval
{ $$ = cat_str(6, $1, make_str("("), $3, make_str(")"), $5, $6); }
- | DEFAULT
+ | DEFAULT
{ $$ = make_str("default"); }
- | LOCAL
+ | LOCAL
{ $$ = make_str("local"); }
;
| RESTRICT { $$ = make_str("restrict"); }
| /* EMPTY */ { $$ = EMPTY; }
;
-
+
/*****************************************************************************
*
* QUERY :
copy_opt_list: copy_opt_list copy_opt_item { $$ = cat2_str($1, $2); }
| /* EMPTY */ { $$ = EMPTY; }
;
-
+
copy_opt_item: BINARY { $$ = make_str("binary"); }
| OIDS { $$ = make_str("oids"); }
| DELIMITER opt_as StringConst
opt_oids: WITH OIDS { $$ = make_str("with oids"); }
| /* EMPTY */ { $$ = EMPTY; }
;
-
-
+
+
/*
* the default copy delimiter is tab but the user can configure it
*/
CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
OptInherit OptWithOids OnCommitOption
{ $$ = cat_str(10, make_str("create"), $2, make_str("table"), $4, make_str("("), $6, make_str(")"), $8, $9, $10); }
- | CREATE OptTemp TABLE qualified_name OF qualified_name
+ | CREATE OptTemp TABLE qualified_name OF qualified_name
'(' OptTableElementList ')' OptWithOids OnCommitOption
{ $$ = cat_str(11, make_str("create"), $2, make_str("table"), $4, make_str("of"), $6, make_str("("), $8, make_str(")"), $10, $11); }
;
| TableElementList ',' TableElement
{ $$ = cat_str(3, $1, make_str(","), $3); }
;
-
+
TableElement: columnDef { $$ = $1; }
| TableLikeClause { $$ = $1; }
| TableConstraint { $$ = $1; }
;
TableLikeClause: LIKE any_name
- {
- mmerror(PARSE_ERROR, ET_ERROR, "LIKE in table definitions not yet supported");
+ {
+ mmerror(PARSE_ERROR, ET_ERROR, "LIKE in table definitions not yet supported");
$$ = cat2_str(make_str("like"), $2);
}
;
-
+
/* ConstraintElem specifies constraint syntax which is not embedded into
* a column definition. ColConstraintElem specifies the embedded form.
* - thomas 1997-12-03
| /*EMPTY*/ { $$ = EMPTY; }
;
-key_delete: ON DELETE_P key_action
+key_delete: ON DELETE_P key_action
{ $$ = cat2_str(make_str("on delete"), $3); }
;
-key_update: ON UPDATE key_action
+key_update: ON UPDATE key_action
{ $$ = cat2_str(make_str("on update"), $3); }
;
| SET NULL_P { $$ = make_str("set null"); }
;
-OptInherit: INHERITS '(' qualified_name_list ')'
+OptInherit: INHERITS '(' qualified_name_list ')'
{ $$ = cat_str(3, make_str("inherits ("), $3, make_str(")")); }
- | /*EMPTY*/
+ | /*EMPTY*/
{ $$ = EMPTY; }
;
| ON COMMIT PRESERVE ROWS { $$ = make_str("on commit preserve rows"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
-
+
/*
* Note: CREATE TABLE ... AS SELECT ... is just another spelling for
*/
CreateAsStmt: CREATE OptTemp TABLE qualified_name OptCreateAs AS
- { FoundInto = 0; }
+ { FoundInto = 0; }
SelectStmt
{
if (FoundInto == 1)
}
;
-OptCreateAs: '(' CreateAsList ')'
+OptCreateAs: '(' CreateAsList ')'
{ $$ = cat_str(3, make_str("("), $2, make_str(")")); }
- | /*EMPTY*/
+ | /*EMPTY*/
{ $$ = EMPTY; }
;
-CreateAsList: CreateAsList ',' CreateAsElement
+CreateAsList: CreateAsList ',' CreateAsElement
{ $$ = cat_str(3, $1, make_str(","), $3); }
- | CreateAsElement
+ | CreateAsElement
{ $$ = $1; }
;
opt_by: BY { $$ = make_str("by"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
-
+
/*****************************************************************************
*
* QUERIES :
}
;
-ConstraintDeferrabilitySpec: NOT DEFERRABLE
+ConstraintDeferrabilitySpec: NOT DEFERRABLE
{ $$ = make_str("not deferrable"); }
- | DEFERRABLE
+ | DEFERRABLE
{ $$ = make_str("deferrable"); }
;
-ConstraintTimeSpec: INITIALLY IMMEDIATE
+ConstraintTimeSpec: INITIALLY IMMEDIATE
{ $$ = make_str("initially immediate"); }
- | INITIALLY DEFERRED
+ | INITIALLY DEFERRED
{ $$ = make_str("initially deferred"); }
;
}
;
-
+
/*****************************************************************************
*
* QUERY :
{ $$ = cat_str(3, make_str("("), $2, make_str(")"));}
;
-definition: '(' def_list ')'
+definition: '(' def_list ')'
{ $$ = cat_str(3, make_str("("), $2, make_str(")")); }
;
opclass_item_list: opclass_item { $$ = $1; }
| opclass_item_list ',' opclass_item { $$ = cat_str(3, $1, make_str(","), $3); }
;
-
+
opclass_item: OPERATOR PosIntConst any_operator opt_recheck
{ $$ = cat_str(4, make_str("operator"), $2, $3, $4); }
| OPERATOR PosIntConst any_operator '(' oper_argtypes ')' opt_recheck
| STORAGE Typename
{ $$ = cat2_str(make_str("storage"), $2); }
;
-
+
opt_default: DEFAULT { $$ = make_str("default"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behavior
{ $$ = cat_str(5,make_str("drop operator class"), $4, make_str("using"), $6, $7); }
;
-
+
/*****************************************************************************
*
* QUERY:
* truncate table relname
*
*****************************************************************************/
-TruncateStmt: TRUNCATE opt_table qualified_name
+TruncateStmt: TRUNCATE opt_table qualified_name
{ $$ = cat_str(3, make_str("truncate table"), $2, $3); }
;
| privilege_list { $$ = $1; }
;
-privilege_list: privilege
+privilege_list: privilege
{ $$ = $1; }
- | privilege_list ',' privilege
+ | privilege_list ',' privilege
{ $$ = cat_str(3, $1, make_str(","), $3); }
;
| TEMP { $$ = make_str("temp"); }
;
-privilege_target: qualified_name_list
+privilege_target: qualified_name_list
{ $$ = $1; }
- | TABLE qualified_name_list
+ | TABLE qualified_name_list
{ $$ = cat2_str(make_str("table"), $2); }
| FUNCTION function_with_argtypes_list
{ $$ = cat2_str(make_str("function"), $2); }
| DATABASE name_list
{ $$ = cat2_str(make_str("database"), $2); }
- | LANGUAGE name_list
+ | LANGUAGE name_list
{ $$ = cat2_str(make_str("language") , $2); }
- | SCHEMA name_list
+ | SCHEMA name_list
{ $$ = cat2_str(make_str("schema") , $2); }
;
-grantee_list: grantee
+grantee_list: grantee
{ $$ = $1; }
- | grantee_list ',' grantee
+ | grantee_list ',' grantee
{ $$ = cat_str(3, $1, make_str(","), $3); }
;
| /*EMPTY*/ { $$ = EMPTY; }
;
-access_method_clause: USING access_method
+access_method_clause: USING access_method
{ $$ = cat2_str(make_str("using"), $2); }
- | /*EMPTY*/
+ | /*EMPTY*/
{ $$ = EMPTY; }
;
{ $$ = cat2_str($1, $2); }
;
-createfunc_opt_item: AS func_as
+createfunc_opt_item: AS func_as
{ $$ = cat2_str(make_str("as"), $2); }
| LANGUAGE ColId_or_Sconst
{ $$ = cat2_str(make_str("language"), $2); }
;
any_operator:
- all_Op
+ all_Op
{ $$ = $1; }
- | ColId '.' any_operator
+ | ColId '.' any_operator
{ $$ = cat_str(3, $1, make_str("."), $3); }
;
trans_options: ISOLATION LEVEL iso_level { $$ = cat2_str(make_str("isolation level"), $3); }
;
-
+
opt_trans: WORK { $$ = EMPTY; }
| TRANSACTION { $$ = EMPTY; }
| /*EMPTY*/ { $$ = EMPTY; }
$$ = cat_str(6, make_str("create domain"), $3, $4, $5, $6, $7);
}
;
-
+
opt_as: AS {$$ = make_str("as"); }
| /* EMPTY */ {$$ = EMPTY; }
;
/*
-conflicts with ecpg
+conflicts with ecpg
PrepareStmt: PREPARE name prep_type_clause AS OptimizableStmt
{ $$ = cat_str(5, make_str("prepare"), $2, $3, make_str("as"), $5); }
select_no_parens: simple_select
{ $$ = $1; }
- | select_clause sort_clause
+ | select_clause sort_clause
{ $$ = cat2_str($1, $2); }
| select_clause opt_sort_clause for_update_clause opt_select_limit
{ $$ = cat_str(4, $1, $2, $3, $4); }
Bit: BitWithLength { $$ = $1; }
| BitWithoutLength { $$ = $1; }
;
-
+
ConstBit: BitWithLength { $$ = $1; }
| BitWithoutLength { $$ = $1; }
;
Character: CharacterWithLength { $$ = $1; }
| CharacterWithoutLength { $$ = $1; }
;
-
+
ConstCharacter: CharacterWithLength { $$ = $1; }
| CharacterWithoutLength { $$ = $1; }
;
| a_expr IS NOT UNKNOWN
{ $$ = cat2_str($1, make_str("is not unknown")); }
| a_expr IS DISTINCT FROM a_expr %prec IS
- { $$ = cat_str(3, $1, make_str("is distinct from"), $5); }
+ { $$ = cat_str(3, $1, make_str("is distinct from"), $5); }
| a_expr IS OF '(' type_list ')' %prec IS
- { $$ = cat_str(4, $1, make_str("is of ("), $5, make_str(")")); }
+ { $$ = cat_str(4, $1, make_str("is of ("), $5, make_str(")")); }
| a_expr IS NOT OF '(' type_list ')' %prec IS
- { $$ = cat_str(4, $1, make_str("is not of ("), $6, make_str(")")); }
+ { $$ = cat_str(4, $1, make_str("is not of ("), $6, make_str(")")); }
| a_expr BETWEEN b_expr AND b_expr %prec BETWEEN
{ $$ = cat_str(5, $1, make_str("between"), $3, make_str("and"), $5); }
| a_expr NOT BETWEEN b_expr AND b_expr %prec BETWEEN
* inside parentheses, such as function arguments; that cannot introduce
* ambiguity to the b_expr syntax.
*/
-c_expr: columnref
+c_expr: columnref
{ $$ = $1; }
| AexprConst
{ $$ = $1; }
| dotted_name opt_indirection
{ $$ = cat2_str($1, $2); }
;
-
-dotted_name: relation_name attrs
+
+dotted_name: relation_name attrs
{ $$ = cat2_str($1, $2); }
;
{ $$ = cat_str(3, $1, $2, $3); }
| ConstInterval '(' PosIntConst ')' StringConst opt_interval
{ $$ = cat_str(6, $1, make_str("("), $3, make_str(")"), $5, $6); }
- | PARAM opt_indirection
+ | PARAM opt_indirection
{ $$ = cat2_str(make_str("param"), $2); }
| TRUE_P
{ $$ = make_str("true"); }
/* an initializer specified */
initializer = 0;
}
- type opt_pointer ECPGColLabel opt_type_array_bounds ';'
+ type opt_pointer ECPGColLabel opt_type_array_bounds ';'
{
/* add entry to list */
struct typedefs *ptr, *this;
$$ = make_str("?");
}
- | EXECUTE name
+ | EXECUTE name
{
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
| EXISTS { $$ = make_str("exists"); }
| EXTRACT { $$ = make_str("extract"); }
| FLOAT_P { $$ = make_str("float"); }
-/* INT must be excluded from ECPGColLabel because of conflict
+/* INT must be excluded from ECPGColLabel because of conflict
| INT { $$ = make_str("int"); }
*/
| INTEGER { $$ = make_str("integer"); }
| SQL_INDICATOR name { check_indicator((find_variable($2))->type); $$ = $2; }
;
-ident: IDENT { $$ = $1; }
+ident: IDENT { $$ = $1; }
| CSTRING { $$ = make3_str(make_str("\""), $1, make_str("\"")); }
;
-quoted_ident_stringvar: name
+quoted_ident_stringvar: name
{ $$ = make3_str(make_str("\""), $1, make_str("\"")); }
| char_variable
{ $$ = make3_str(make_str("("), $1, make_str(")")); }