1- /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.315 2005/12/29 04:53:18 neilc Exp $*/
1+ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.316 2006/01/24 11:01:37 meskes Exp $*/
22
33/* Copyright comment*/
44%{
@@ -377,7 +377,7 @@ add_additional_variables(char *name, bool insert)
377377
378378HANDLER HAVING HEADER_P HOLD HOUR_P
379379
380- ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
380+ IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
381381INDEX INHERIT INHERITS INITIALLY INNER_P INOUT INPUT_P
382382INSENSITIVE INSERT INSTEAD INT_P INTEGER INTERSECT
383383INTERVAL INTO INVOKER IS ISNULL ISOLATION
@@ -397,15 +397,15 @@ add_additional_variables(char *name, bool insert)
397397NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF NUMERIC
398398
399399OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR ORDER
400- OUT_P OUTER_P OVERLAPS OVERLAY OWNER
400+ OUT_P OUTER_P OVERLAPS OVERLAYOWNED OWNER
401401
402402PARTIAL PASSWORD PLACING POSITION
403403PRECISION PRESERVE PREPARE PREPARED PRIMARY
404404PRIOR PRIVILEGES PROCEDURAL PROCEDURE
405405
406406QUOTE
407407
408- READ REAL RECHECK REFERENCES REINDEX RELATIVE_P RELEASE RENAME
408+ READ REALREASSIGN RECHECK REFERENCES REINDEX RELATIVE_P RELEASE RENAME
409409REPEATABLE REPLACE RESET RESTART RESTRICT RETURNS REVOKE RIGHT
410410ROLE ROLLBACK ROW ROWS RULE
411411
@@ -520,7 +520,7 @@ add_additional_variables(char *name, bool insert)
520520%type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_item ExplainableStmt
521521%type <str> createdb_opt_list opt_encoding OptInherit opt_equal
522522%type <str> privilege_list privilege privilege_target
523- %type <str> opt_grant_grant_option cursor_options
523+ %type <str> opt_grant_grant_option cursor_options DropOwnedStmt
524524%type <str> transaction_mode_list_or_empty transaction_mode_list
525525%type <str> function_with_argtypes_list function_with_argtypes IntConstVar
526526%type <str> DropdbStmt ClusterStmt grantee RevokeStmt Bit DropOpClassStmt
@@ -531,7 +531,7 @@ add_additional_variables(char *name, bool insert)
531531%type <str> ConstraintTimeSpec AlterDatabaseSetStmt DropAssertStmt
532532%type <str> select_offset_value ReindexStmt join_type opt_boolean
533533%type <str> join_qual joined_table opclass_item
534- %type <str> lock_type array_expr_list
534+ %type <str> lock_type array_expr_list ReassignOwnedStmt
535535%type <str> OptConstrFromTable OptTempTableName StringConst array_expr
536536%type <str> constraints_set_mode comment_type
537537%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
@@ -698,6 +698,7 @@ stmt: AlterDatabaseStmt{ output_statement($1, 0, connection); }
698698| DropCastStmt { output_statement($1 ,0 , connection); }
699699| DropGroupStmt { output_statement($1 ,0 , connection); }
700700| DropOpClassStmt { output_statement($1 ,0 , connection); }
701+ | DropOwnedStmt { output_statement($1 ,0 , connection); }
701702| DropPLangStmt { output_statement($1 ,0 , connection); }
702703| DropRoleStmt { output_statement($1 ,0 , connection); }
703704| DropRuleStmt { output_statement($1 ,0 , connection); }
@@ -718,6 +719,7 @@ stmt: AlterDatabaseStmt{ output_statement($1, 0, connection); }
718719| LockStmt { output_statement($1 ,0 , connection); }
719720| NotifyStmt { output_statement($1 ,0 , connection); }
720721/* | PrepareStmt{ output_statement($1, 0, connection); }*/
722+ | ReassignOwnedStmt { output_statement($1 ,0 , connection); }
721723| ReindexStmt { output_statement($1 ,0 , connection); }
722724| RemoveAggrStmt { output_statement($1 ,0 , connection); }
723725| RemoveOperStmt { output_statement($1 ,0 , connection); }
@@ -924,6 +926,7 @@ opt_with: WITH { $$ = make_str("with"); }
924926*/
925927OptRoleList :
926928PASSWORD Sconst {$$ = cat2_str(make_str(" password" ),$2 ); }
929+ | PASSWORD NULL_P {$$ = make_str(" password null" ); }
927930| ENCRYPTED PASSWORD Sconst {$$ = cat2_str(make_str(" encrypted password" ),$3 ); }
928931| UNENCRYPTED PASSWORD Sconst {$$ = cat2_str(make_str(" unencrypted password" ),$3 ); }
929932| SUPERUSER_P {$$ = make_str(" superuser" ); }
@@ -1995,11 +1998,35 @@ DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behav
19951998 *
19961999 *QUERY:
19972000 *
1998- * DROP itemtype itemname [, itemname ...]
2001+ *DROP OWNED BY username [, username ...] [ RESTRICT | CASCADE ]
2002+ *REASSIGN OWNED BY username [, username ...] TO username
2003+ *
2004+ *****************************************************************************/
2005+ DropOwnedStmt :
2006+ DROP OWNED BY name_list opt_drop_behavior
2007+ {
2008+ $$ = cat_str(3 , make_str(" drop owned by" ),$4 ,$5 );
2009+ }
2010+ ;
2011+
2012+ ReassignOwnedStmt :
2013+ REASSIGN OWNED BY name_list TO name
2014+ {
2015+ $$ = cat_str(4 , make_str(" reassign owned by" ),$4 , make_str(" to" ),$6 );
2016+ }
2017+ ;
2018+
2019+ /* ****************************************************************************
2020+ *
2021+ *QUERY:
2022+ *
2023+ * DROP itemtype [ IF EXISTS ] itemname [, itemname ...] [ RESTRICT | CASCADE ]
19992024 *
20002025 *****************************************************************************/
20012026
2002- DropStmt :DROP drop_type any_name_list opt_drop_behavior
2027+ DropStmt :DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior
2028+ {$$ = cat_str(5 , make_str(" drop" ),$2 , make_str(" if exists" ),$5 ,$6 ); }
2029+ | DROP drop_type any_name_list opt_drop_behavior
20032030{$$ = cat_str(4 , make_str(" drop" ),$2 ,$3 ,$4 ); }
20042031;
20052032
@@ -2818,13 +2845,15 @@ alterdb_opt_item:
28182845
28192846/* ****************************************************************************
28202847 *
2821- *DROP DATABASE
2848+ *DROP DATABASE [ IF EXISTS ]
28222849 *
28232850 *
28242851 *****************************************************************************/
28252852
28262853DropdbStmt :DROP DATABASE database_name
28272854{$$ = cat2_str(make_str(" drop database" ),$3 ); }
2855+ | DROP DATABASE IF_P EXISTS database_name
2856+ {$$ = cat2_str(make_str(" drop database if exists" ),$5 ); }
28282857;
28292858
28302859
@@ -3806,6 +3835,8 @@ a_expr: c_expr
38063835{$$ = cat2_str($1 , make_str(" is not unknown" )); }
38073836| a_expr IS DISTINCT FROM a_expr %prec IS
38083837{$$ = cat_str(3 ,$1 , make_str(" is distinct from" ),$5 ); }
3838+ | a_expr IS NOT DISTINCT FROM a_expr %prec IS
3839+ {$$ = cat_str(3 ,$1 , make_str(" is not distinct from" ),$6 ); }
38093840| a_expr IS OF ' (' type_list ' )' %prec IS
38103841{$$ = cat_str(4 ,$1 , make_str(" is of (" ),$5 , make_str(" )" )); }
38113842| a_expr IS NOT OF ' (' type_list ' )' %prec IS
@@ -3870,6 +3901,8 @@ b_expr: c_expr
38703901{$$ = cat2_str($1 ,$2 ); }
38713902| b_expr IS DISTINCT FROM b_expr %prec IS
38723903{$$ = cat_str(3 ,$1 , make_str(" is distinct from" ),$5 ); }
3904+ | b_expr IS NOT DISTINCT FROM b_expr %prec IS
3905+ {$$ = cat_str(3 ,$1 , make_str(" is not distinct from" ),$6 ); }
38733906| b_expr IS OF ' (' b_expr ' )' %prec IS
38743907{$$ = cat_str(4 ,$1 , make_str(" is of (" ),$5 , make_str(" )" )); }
38753908| b_expr IS NOT OF ' (' b_expr ' )' %prec IS
@@ -6111,6 +6144,7 @@ ECPGunreserved_con: ABORT_P{ $$ = make_str("abort"); }
61116144| HEADER_P {$$ = make_str(" header" ); }
61126145| HOLD {$$ = make_str(" hold" ); }
61136146/* | HOUR_P{ $$ = make_str("hour"); }*/
6147+ | IF_P {$$ = make_str(" if" ); }
61146148| IMMEDIATE {$$ = make_str(" immediate" ); }
61156149| IMMUTABLE {$$ = make_str(" immutable" ); }
61166150| IMPLICIT_P {$$ = make_str(" implicit" ); }
@@ -6159,6 +6193,7 @@ ECPGunreserved_con: ABORT_P{ $$ = make_str("abort"); }
61596193| OIDS {$$ = make_str(" oids" ); }
61606194| OPERATOR {$$ = make_str(" operator" ); }
61616195| OPTION {$$ = make_str(" option" ); }
6196+ | OWNED {$$ = make_str(" owned" ); }
61626197| OWNER {$$ = make_str(" owner" ); }
61636198| PARTIAL {$$ = make_str(" partial" ); }
61646199| PASSWORD {$$ = make_str(" password" ); }
@@ -6171,6 +6206,7 @@ ECPGunreserved_con: ABORT_P{ $$ = make_str("abort"); }
61716206| PROCEDURE {$$ = make_str(" procedure" ); }
61726207| QUOTE {$$ = make_str(" quote" ); }
61736208| READ {$$ = make_str(" read" ); }
6209+ | REASSIGN {$$ = make_str(" reassign" ); }
61746210| RECHECK {$$ = make_str(" recheck" ); }
61756211| REINDEX {$$ = make_str(" reindex" ); }
61766212| RELATIVE_P {$$ = make_str(" relative" ); }