diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 78c47d31a6..e801b1a6a5 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -2362,6 +2362,10 @@ Tue, 20 May 2008 17:31:01 +0200 Wed, 04 Jun 2008 14:22:30 +0200 - Added lost symbol SQL to list of allowed variable names. + +Tue, 24 Jun 2008 13:30:51 +0200 + + - Synced parser. - Set pgtypes library version to 3.1. - Set compat library version to 3.1. - Set ecpg library version to 6.2. diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 661a36ea67..56e38c3497 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.367 2008/06/04 12:23:34 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.368 2008/06/26 08:04:05 meskes Exp $ */ /* Copyright comment */ %{ @@ -556,15 +556,15 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu %type target_list target_el alias_clause type_func_name_keyword %type qualified_name database_name alter_using type_function_name %type access_method attr_name index_name name func_name opt_restart_seqs -%type file_name AexprConst c_expr ConstTypename var_list +%type file_name AexprConst c_expr ConstTypename var_list %type a_expr b_expr TruncateStmt CommentStmt OnCommitOption opt_by -%type opt_indirection expr_list extract_list extract_arg +%type opt_indirection expr_list extract_list extract_arg OptSeqOptList %type position_list substr_list substr_from alter_column_default %type trim_list in_expr substr_for attrs TableFuncElement %type Typename SimpleTypename Numeric opt_float DiscardStmt %type Character character opt_varying opt_charset enum_val_list %type opt_timezone opt_interval table_ref fetch_direction -%type ConstDatetime AlterDomainStmt AlterSeqStmt alter_rel_cmds +%type ConstDatetime AlterDomainStmt AlterSeqStmt %type SelectStmt into_clause OptTemp ConstraintAttributeSpec %type opt_table opt_all sort_clause sortby_list ConstraintAttr %type sortby qualified_name_list name_list ColId_or_Sconst @@ -591,8 +591,8 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu %type VariableSetStmt var_value zone_value VariableShowStmt %type VariableResetStmt AlterTableStmt from_list overlay_list %type relation_name OptTableSpace LockStmt opt_lock -%type CreateUserStmt AlterUserStmt CreateSeqStmt OptSeqList -%type OptSeqElem TriggerForSpec TriggerForOpt TriggerForType +%type CreateUserStmt AlterUserStmt CreateSeqStmt SeqOptList +%type SeqOptElem TriggerForSpec TriggerForOpt TriggerForType %type DropTrigStmt TriggerOneEvent TriggerEvents RuleActionStmt %type TriggerActionTime CreateTrigStmt DropPLangStmt DropCastStmt %type CreatePLangStmt TriggerFuncArgs TriggerFuncArg simple_select @@ -621,7 +621,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu %type handler_name any_name_list any_name opt_as insert_column_list %type columnref values_clause AllConstVar prep_type_clause ExecuteStmt %type insert_column_item DropRuleStmt ctext_expr execute_param_clause -%type createfunc_opt_item set_rest alter_rel_cmd +%type createfunc_opt_item set_rest %type CreateFunctionStmt createfunc_opt_list func_table %type DropUserStmt copy_from copy_opt_list copy_opt_item %type opt_oids TableLikeClause key_action opt_definition @@ -1347,55 +1347,58 @@ DiscardStmt: /***************************************************************************** * - * ALTER [ TABLE | INDEX ] variations + * ALTER [ TABLE | INDEX | SEQUENCE | VIEW ] variations * *****************************************************************************/ AlterTableStmt: ALTER TABLE relation_expr alter_table_cmds { $$ = cat_str(3, make_str("alter table"), $3, $4); } - | ALTER INDEX relation_expr alter_rel_cmds - { $$ = cat_str(3, make_str("alter table"), $3, $4); } + | ALTER INDEX relation_expr alter_table_cmds + { $$ = cat_str(3, make_str("alter index"), $3, $4); } + | ALTER SEQUENCE relation_expr alter_table_cmds + { $$ = cat_str(3, make_str("alter sequence"), $3, $4); } + | ALTER VIEW relation_expr alter_table_cmds + { $$ = cat_str(3, make_str("alter view"), $3, $4); } ; -/* Subcommands that are for ALTER TABLE only */ alter_table_cmds: alter_table_cmd { $$ = $1; } | alter_table_cmds ',' alter_table_cmd { $$ = cat_str(3, $1, make_str(","), $3); } ; alter_table_cmd: +/* ALTER TABLE ADD [COLUMN] */ ADD_P opt_column columnDef -/* ALTER TABLE ADD [COLUMN] */ { $$ = cat_str(3, make_str("add"), $2, $3); } -/* ALTER TABLE ALTER [COLUMN] {SET DEFAULT |DROP DEFAULT} */ +/* ALTER TABLE ALTER [COLUMN] {SET DEFAULT |DROP DEFAULT} */ | ALTER opt_column ColId alter_column_default { $$ = cat_str(4, make_str("alter"), $2, $3, $4); } -/* ALTER TABLE ALTER [COLUMN] DROP NOT NULL */ +/* ALTER TABLE ALTER [COLUMN] DROP NOT NULL */ | ALTER opt_column ColId DROP NOT NULL_P { $$ = cat_str(4, make_str("alter"), $2, $3, make_str("drop not null")); } -/* ALTER TABLE ALTER [COLUMN] SET NOT NULL */ +/* ALTER TABLE ALTER [COLUMN] SET NOT NULL */ | ALTER opt_column ColId SET NOT NULL_P { $$ = cat_str(4, make_str("alter"), $2, $3, make_str("set not null")); } -/* ALTER TABLE ALTER [COLUMN] SET STATISTICS */ +/* ALTER TABLE ALTER [COLUMN] SET STATISTICS */ | ALTER opt_column ColId SET STATISTICS PosIntConst { $$ = cat_str(5, make_str("alter"), $2, $3, make_str("set statistics"), $6); } -/* ALTER TABLE ALTER [COLUMN] SET STORAGE */ +/* ALTER TABLE ALTER [COLUMN] SET STORAGE */ | ALTER opt_column ColId SET STORAGE ColId { $$ = cat_str(5, make_str("alter"), $2, $3, make_str("set storage"), $6); } -/* ALTER TABLE DROP [COLUMN] {RESTRICT|CASCADE} */ +/* ALTER TABLE DROP [COLUMN] {RESTRICT|CASCADE} */ | DROP opt_column ColId opt_drop_behavior { $$ = cat_str(4, make_str("drop"), $2, $3, $4); } -/* ALTER TABLE ALTER [COLUMN] TYPE [ USING ] */ +/* ALTER TABLE ALTER [COLUMN] TYPE [ USING ] */ | ALTER opt_column ColId TYPE_P Typename alter_using { $$ = cat_str(6, make_str("alter"), $2, $3, make_str("type"), $5, $6); } -/* ALTER TABLE ADD CONSTRAINT ... */ +/* ALTER TABLE ADD CONSTRAINT ... */ | ADD_P TableConstraint { $$ = cat_str(2, make_str("add"), $2); } -/* ALTER TABLE DROP CONSTRAINT ... */ +/* ALTER TABLE DROP CONSTRAINT ... */ | DROP CONSTRAINT name opt_drop_behavior { $$ = cat_str(3, make_str("drop constraint"), $3, $4); } -/* ALTER TABLE SET WITHOUT OIDS */ +/* ALTER TABLE SET WITHOUT OIDS */ | SET WITHOUT OIDS { $$ = make_str("set without oids"); } /* ALTER TABLE CLUSTER ON */ @@ -1446,20 +1449,10 @@ alter_table_cmd: /* ALTER TABLE NO INHERITS */ | NO INHERIT qualified_name { $$ = cat2_str(make_str("no inherit"), $3); } - | alter_rel_cmd - { $$ = $1; } - ; - -alter_rel_cmds: alter_rel_cmd { $$ = $1; } - | alter_rel_cmds ',' alter_rel_cmd { $$ = cat_str(3, $1, make_str(","), $3); } - ; - -/* Subcommands that are for ALTER TABLE or ALTER INDEX */ -alter_rel_cmd: - /* ALTER [TABLE|INDEX] OWNER TO RoleId */ - OWNER TO RoleId + /* ALTER OWNER TO RoleId */ + | OWNER TO RoleId { $$ = cat2_str(make_str("owner to"), $3); } - /* ALTER [TABLE|INDEX] SET TABLESPACE */ + /* ALTER SET TABLESPACE */ | SET TABLESPACE name { $$ = cat2_str(make_str("set tablespace"), $3); } | SET definition @@ -1830,19 +1823,23 @@ CreateAsElement: ColId { $$ = $1; } * *****************************************************************************/ -CreateSeqStmt: CREATE OptTemp SEQUENCE qualified_name OptSeqList +CreateSeqStmt: CREATE OptTemp SEQUENCE qualified_name OptSeqOptList { $$ = cat_str(5, make_str("create"), $2, make_str("sequence"), $4, $5); } ; -AlterSeqStmt: ALTER SEQUENCE qualified_name OptSeqList +AlterSeqStmt: ALTER SEQUENCE relation_expr SeqOptList { $$ = cat_str(3,make_str("alter sequence"), $3, $4); } ; -OptSeqList: OptSeqList OptSeqElem { $$ = cat2_str($1, $2); } - | /*EMPTY*/ { $$ = EMPTY; } +OptSeqOptList: SeqOptList { $$ = $1; } + | /*EMPTY*/ { $$ = EMPTY; } ; -OptSeqElem: CACHE NumConst +SeqOptList: SeqOptElem { $$ = $1; } + | SeqOptList SeqOptElem { $$ = cat2_str($1, $2); } + ; + +SeqOptElem: CACHE NumConst { $$ = cat2_str(make_str("cache"), $2); } | CYCLE { $$ = make_str("cycle"); } @@ -2841,6 +2838,8 @@ RenameStmt: ALTER AGGREGATE func_name aggr_args RENAME TO name { $$ = cat_str(4, make_str("alter schema"), $3, make_str("rename to"), $6); } | ALTER TABLE relation_expr RENAME TO name { $$ = cat_str(4, make_str("alter table"), $3, make_str("rename to"), $6); } + | ALTER TABLE relation_expr SET SCHEMA name + { $$ = cat_str(4, make_str("alter table"), $3, make_str("set schema"), $6); } | ALTER SEQUENCE relation_expr RENAME TO name { $$ = cat_str(4, make_str("alter sequence"), $3, make_str("rename to"), $6); } | ALTER VIEW relation_expr RENAME TO name @@ -2886,7 +2885,7 @@ AlterObjectSchemaStmt: { $$ = cat_str(4, make_str("alter function"), $3, make_str("set schema"), $6); } | ALTER SEQUENCE relation_expr SET SCHEMA name { $$ = cat_str(4, make_str("alter sequence"), $3, make_str("set schema"), $6); } - | ALTER TABLE relation_expr SET SCHEMA name + | ALTER VIEW relation_expr SET SCHEMA name { $$ = cat_str(4, make_str("alter sequence"), $3, make_str("set schema"), $6); } | ALTER TYPE_P any_name SET SCHEMA name { $$ = cat_str(4, make_str("alter type"), $3, make_str("set schema"), $6); }