-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.205 2002/12/13 20:29:07 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.206 2003/01/21 20:01:12 meskes Exp $ */
/* Copyright comment */
%{
%type comment_text ConstraintDeferrabilitySpec TableElementList
%type key_match ColLabel SpecialRuleRelation ColId columnDef
%type ColConstraint ColConstraintElem drop_type Bconst
-%type TableConstraint OptTableElementList Xconst
+%type TableConstraint OptTableElementList Xconst opt_transaction
%type ConstraintElem key_actions ColQualList type_name
%type target_list target_el update_target_list alias_clause
%type update_target_el opt_id qualified_name database_name
%type Typename SimpleTypename Numeric opt_float opt_numeric
%type opt_decimal Character character opt_varying opt_charset
%type opt_collate opt_timezone opt_interval table_ref
-%type row_descriptor ConstDatetime trans_options
+%type row_descriptor ConstDatetime AlterDomainStmt
%type SelectStmt into_clause OptTemp ConstraintAttributeSpec
%type opt_table opt_all sort_clause sortby_list ConstraintAttr
%type sortby OptUseOp qualified_name_list name_list ColId_or_Sconst
%type RemoveOperStmt RenameStmt all_Op opt_Trusted opt_lancompiler
%type VariableSetStmt var_value zone_value VariableShowStmt
%type VariableResetStmt AlterTableStmt from_list overlay_list
-%type opt_trans user_list OptUserList OptUserElem relation_name
+%type user_list OptUserList OptUserElem relation_name
%type CreateUserStmt AlterUserStmt CreateSeqStmt OptSeqList
%type OptSeqElem TriggerForSpec TriggerForOpt TriggerForType
%type DropTrigStmt TriggerOneEvent TriggerEvents RuleActionStmt
%type createdb_opt_list opt_encoding OptInherit opt_equal
%type AlterUserSetStmt privilege_list privilege privilege_target
%type opt_grant_grant_option opt_revoke_grant_option
+%type transaction_mode_list_or_empty transaction_mode_list
%type function_with_argtypes_list function_with_argtypes
%type DropdbStmt ClusterStmt grantee RevokeStmt Bit DropOpClassStmt
%type GrantStmt privileges PosAllConst constraints_set_list
%type insert_target_list insert_column_item DropRuleStmt
%type createfunc_opt_item set_rest var_list_or_default
%type CreateFunctionStmt createfunc_opt_list func_table
-%type DropUserStmt copy_from copy_opt_list opt_mode copy_opt_item
+%type DropUserStmt copy_from copy_opt_list copy_opt_item
%type opt_oids TableLikeClause key_action opt_definition
%type cast_context row r_expr qual_Op qual_all_Op opt_default
%type CreateConversionStmt any_operator opclass_item_list
%type iso_level type_list CharacterWithLength ConstCharacter
%type CharacterWithoutLength BitWithLength BitWithoutLength
%type ConstBit GenericType TableFuncElementList
-%type opt_sort_clause
+%type opt_sort_clause transaction_access_mode
%type ECPGWhenever ECPGConnect connection_target ECPGOpen
%type indicator ECPGExecute ECPGPrepare opt_ecpg_using ecpg_into
};
stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
+ | AlterDomainStmt { output_statement($1, 0, connection); }
| AlterGroupStmt { output_statement($1, 0, connection); }
| AlterTableStmt { output_statement($1, 0, connection); }
| AlterUserStmt { output_statement($1, 0, connection); }
{ $$ = cat_str(3, $1, make_str("="), $3); }
| TIME ZONE zone_value
{ $$ = cat2_str(make_str("time zone"), $3); }
- | TRANSACTION ISOLATION LEVEL iso_level opt_mode
- { $$ = cat_str(3, make_str("transaction isolation level"), $4, $5); }
- | SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL iso_level
- { $$ = cat2_str(make_str("session characteristics as transaction isolation level"), $7); }
+ | TRANSACTION transaction_mode_list
+ { $$ = cat2_str(make_str("transaction"), $2); }
+ | SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
+ { $$ = cat2_str(make_str("session characteristics as transaction"), $5); }
| NAMES opt_encoding
{ $$ = cat2_str(make_str("names"), $2); }
| SESSION AUTHORIZATION ColId_or_Sconst
| SERIALIZABLE { $$ = make_str("serializable"); }
;
-opt_mode: READ WRITE { $$ = make_str("read write"); }
- | READ ONLY { mmerror(PARSE_ERROR, ET_ERROR, "SET TRANSACTION/READ ONLY is not yet supported");
- $$ = make_str("read only"); }
- | /* EMPTY */ { $$ = EMPTY; }
- ;
-
var_value: opt_boolean { $$ = $1; }
| AllConst { $$ = $1; }
| ColId { $$ = $1; }
*****************************************************************************/
FetchStmt: FETCH direction fetch_how_many from_in name ecpg_into
- {
- if (strcmp($2, "relative") == 0 && atol($3) == 0L)
- mmerror(PARSE_ERROR, ET_ERROR, "FETCH/RELATIVE at current position is not supported");
-
- $$ = cat_str(5, make_str("fetch"), $2, $3, $4, $5);
- }
+ { $$ = cat_str(5, make_str("fetch"), $2, $3, $4, $5); }
| FETCH fetch_how_many from_in name ecpg_into
{ $$ = cat_str(4, make_str("fetch"), $2, $3, $4); }
| FETCH direction from_in name ecpg_into
{ $$ = cat_str(7, make_str("grant"), $2, make_str("on"), $4, make_str("to"), $6, $7); }
;
-RevokeStmt: REVOKE opt_revoke_grant_option privileges ON privilege_target FROM grantee_list
- { $$ = cat_str(8, make_str("revoke"), $2, $3, make_str("on"), $5, make_str("from"), $7); }
+RevokeStmt: REVOKE opt_revoke_grant_option privileges ON privilege_target FROM grantee_list opt_drop_behavior
+ {
+ if (strcmp($8, "drop cascade") == 0)
+ mmerror(PARSE_ERROR, ET_WARNING, "Not implemented REVOKE ... CASCADE will be send to backend");
+
+ $$ = cat_str(9, make_str("revoke"), $2, $3, make_str("on"), $5, make_str("from"), $7, $8);
+ }
+
;
privileges: ALL PRIVILEGES { $$ = make_str("all privileges"); }
* (also older versions END / ABORT)
*
*****************************************************************************/
-TransactionStmt: ABORT_TRANS opt_trans { $$ = make_str("rollback"); }
- | BEGIN_TRANS opt_trans { $$ = make_str("begin transaction"); }
- | START TRANSACTION trans_options { $$ = cat2_str(make_str("start transaction"), $3); }
- | COMMIT opt_trans { $$ = make_str("commit"); }
- | END_TRANS opt_trans { $$ = make_str("commit"); }
- | ROLLBACK opt_trans { $$ = make_str("rollback"); }
- ;
-
-trans_options: ISOLATION LEVEL iso_level { $$ = cat2_str(make_str("isolation level"), $3); }
+TransactionStmt: ABORT_TRANS opt_transaction { $$ = make_str("rollback"); }
+ | BEGIN_TRANS opt_transaction { $$ = make_str("begin transaction"); }
+ | START TRANSACTION transaction_mode_list_or_empty { $$ = cat2_str(make_str("start transaction"), $3); }
+ | COMMIT opt_transaction { $$ = make_str("commit"); }
+ | END_TRANS opt_transaction { $$ = make_str("commit"); }
+ | ROLLBACK opt_transaction { $$ = make_str("rollback"); }
;
-opt_trans: WORK { $$ = EMPTY; }
+opt_transaction: WORK { $$ = EMPTY; }
| TRANSACTION { $$ = EMPTY; }
| /*EMPTY*/ { $$ = EMPTY; }
;
+transaction_mode_list:
+ ISOLATION LEVEL iso_level
+ { $$ = cat2_str(make_str("isolation level"), $3); }
+ | transaction_access_mode
+ { $$ = $1; }
+ | ISOLATION LEVEL iso_level transaction_access_mode
+ { $$ = cat_str(3, make_str("isolation level"), $3, $4); }
+ | transaction_access_mode ISOLATION LEVEL iso_level
+ { $$ = cat_str(3, $1, make_str("isolation level"), $4); }
+ ;
+
+transaction_mode_list_or_empty:
+ transaction_mode_list { $$ = $1; }
+ | /* EMPTY */ { $$ = EMPTY; }
+ ;
+
+transaction_access_mode:
+ READ ONLY { $$ = make_str("read only"); }
+ | READ WRITE { $$ = make_str("read write"); }
+ ;
+
/*****************************************************************************
*
* QUERY:
}
;
+AlterDomainStmt:
+ ALTER DOMAIN_P any_name alter_column_default
+ { $$ = cat_str(3, make_str("alter domain"), $3, $4); }
+ | ALTER DOMAIN_P any_name DROP NOT NULL_P
+ { $$ = cat_str(3, make_str("alter domain"), $3, make_str("drop not null")); }
+ | ALTER DOMAIN_P any_name SET NOT NULL_P
+ { $$ = cat_str(3, make_str("alter domain"), $3, make_str("set not null")); }
+ | ALTER DOMAIN_P any_name ADD TableConstraint
+ { $$ = cat_str(4, make_str("alter domain"), $3, make_str("add"), $5); }
+ | ALTER DOMAIN_P any_name DROP CONSTRAINT name opt_drop_behavior
+ { $$ = cat_str(5, make_str("alter domain"), $3, make_str("drop constraint"), $6, $7); }
+ | ALTER DOMAIN_P any_name OWNER TO UserId
+ { $$ = cat_str(4, make_str("alter domain"), $3, make_str("owner to"), $6); }
+ ;
+
opt_as: AS {$$ = make_str("as"); }
| /* EMPTY */ {$$ = EMPTY; }
;
| INSTEAD { $$ = make_str("instead"); }
| ISOLATION { $$ = make_str("isolation"); }
| KEY { $$ = make_str("key"); }
- | LANGUAGE { $$ = make_str("language"); }
| LANCOMPILER { $$ = make_str("lancompiler"); }
+ | LANGUAGE { $$ = make_str("language"); }
| LAST { $$ = make_str("last"); }
| LEVEL { $$ = make_str("level"); }
| LISTEN { $$ = make_str("listen"); }
| UNIQUE { $$ = make_str("unique"); }
| USER { $$ = make_str("user"); }
| USING { $$ = make_str("using"); }
- | VALUE { $$ = make_str("value"); }
| WHEN { $$ = make_str("when"); }
| WHERE { $$ = make_str("where"); }
;