1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Source code alignment fixes for preproc.y.

This commit is contained in:
Bruce Momjian
2006-02-01 22:16:36 +00:00
parent a274239bce
commit d63901c9d0

View File

@@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.316 2006/01/24 11:01:37 meskes Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.317 2006/02/01 22:16:36 momjian Exp $ */
/* Copyright comment */ /* Copyright comment */
%{ %{
@@ -651,9 +651,11 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
{ {
if (INFORMIX_MODE) if (INFORMIX_MODE)
{ {
/* Informix also has a CLOSE DATABASE command that /*
essantially works like a DISCONNECT CURRENT * Informix also has a CLOSE DATABASE command that
as far as I know. */ * essantially works like a DISCONNECT CURRENT
* as far as I know.
*/
if (pg_strcasecmp($1+strlen("close "), "database") == 0) if (pg_strcasecmp($1+strlen("close "), "database") == 0)
{ {
if (connection) if (connection)
@@ -833,7 +835,8 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
struct cursor *ptr; struct cursor *ptr;
if ((ptr = add_additional_variables($1, true)) != NULL) if ((ptr = add_additional_variables($1, true)) != NULL)
output_statement(mm_strdup(ptr->command), 0, ptr->connection ? mm_strdup(ptr->connection) : NULL); output_statement(mm_strdup(ptr->command), 0,
ptr->connection ? mm_strdup(ptr->connection) : NULL);
ptr->opened = true; ptr->opened = true;
} }
| ECPGPrepare | ECPGPrepare
@@ -957,12 +960,9 @@ OptRoleList:
CreateUserStmt: CreateUserStmt:
CREATE USER RoleId opt_with OptRoleList CREATE USER RoleId opt_with OptRoleList
{ {$$ = cat_str(4, make_str("create user"), $3, $4, $5); }
$$ = cat_str(4, make_str("create user"), $3, $4, $5);
}
; ;
/***************************************************************************** /*****************************************************************************
* *
* Alter a postgresql DBMS role * Alter a postgresql DBMS role
@@ -1345,9 +1345,7 @@ alter_using: USING a_expr { $$ = cat2_str(make_str("using"), $2); }
*****************************************************************************/ *****************************************************************************/
ClosePortalStmt: CLOSE name ClosePortalStmt: CLOSE name
{ { $$ = cat2_str(make_str("close"), $2); }
$$ = cat2_str(make_str("close"), $2);
}
; ;
/***************************************************************************** /*****************************************************************************
@@ -1469,9 +1467,7 @@ TableElement: columnDef { $$ = $1; }
; ;
columnDef: ColId Typename ColQualList columnDef: ColId Typename ColQualList
{ {$$ = cat_str(3, $1, $2, $3); }
$$ = cat_str(3, $1, $2, $3);
}
; ;
ColQualList: ColQualList ColConstraint { $$ = cat2_str($1,$2); } ColQualList: ColQualList ColConstraint { $$ = cat2_str($1,$2); }
@@ -1529,9 +1525,7 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); }
; ;
TableLikeClause: LIKE qualified_name like_including_defaults TableLikeClause: LIKE qualified_name like_including_defaults
{ {$$ = cat_str(3, make_str("like"), $2, $3); }
$$ = cat_str(3, make_str("like"), $2, $3);
}
; ;
like_including_defaults: like_including_defaults:
@@ -1794,7 +1788,9 @@ OptTableSpaceOwner: OWNER name { $$ = cat2_str(make_str("owner"), $2); }
****************************************************************************/ ****************************************************************************/
DropTableSpaceStmt: DROP TABLESPACE name { $$ = cat2_str(make_str("drop tablespace"), $3); }; DropTableSpaceStmt: DROP TABLESPACE name
{ $$ = cat2_str(make_str("drop tablespace"), $3); }
;
/***************************************************************************** /*****************************************************************************
@@ -1806,13 +1802,11 @@ DropTableSpaceStmt: DROP TABLESPACE name { $$ = cat2_str(make_str("drop tablespa
*****************************************************************************/ *****************************************************************************/
CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON
qualified_name TriggerForSpec qualified_name TriggerForSpec EXECUTE PROCEDURE name
EXECUTE PROCEDURE '(' TriggerFuncArgs ')'
name '(' TriggerFuncArgs ')'
{ $$ = cat_str(12, make_str("create trigger"), $3, $4, $5, make_str("on"), $7, $8, make_str("execute procedure"), $11, make_str("("), $13, make_str(")")); } { $$ = cat_str(12, make_str("create trigger"), $3, $4, $5, make_str("on"), $7, $8, make_str("execute procedure"), $11, make_str("("), $13, make_str(")")); }
| CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON | CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON
qualified_name OptConstrFromTable qualified_name OptConstrFromTable ConstraintAttributeSpec
ConstraintAttributeSpec
FOR EACH ROW EXECUTE PROCEDURE FOR EACH ROW EXECUTE PROCEDURE
func_name '(' TriggerFuncArgs ')' func_name '(' TriggerFuncArgs ')'
{ $$ = cat_str(13, make_str("create constraint trigger"), $4, make_str("after"), $6, make_str("on"), $8, $9, $10, make_str("for each row execute procedure"), $16, make_str("("), $18, make_str(")")); } { $$ = cat_str(13, make_str("create constraint trigger"), $4, make_str("after"), $6, make_str("on"), $8, $9, $10, make_str("for each row execute procedure"), $16, make_str("("), $18, make_str(")")); }
@@ -2004,16 +1998,12 @@ DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behav
*****************************************************************************/ *****************************************************************************/
DropOwnedStmt: DropOwnedStmt:
DROP OWNED BY name_list opt_drop_behavior DROP OWNED BY name_list opt_drop_behavior
{ {$$ = cat_str(3, make_str("drop owned by"), $4, $5); }
$$ = cat_str(3, make_str("drop owned by"), $4, $5);
}
; ;
ReassignOwnedStmt: ReassignOwnedStmt:
REASSIGN OWNED BY name_list TO name REASSIGN OWNED BY name_list TO name
{ {$$ = cat_str(4, make_str("reassign owned by"), $4, make_str("to"), $6); }
$$ = cat_str(4, make_str("reassign owned by"), $4, make_str("to"), $6);
}
; ;
/***************************************************************************** /*****************************************************************************
@@ -2193,14 +2183,9 @@ GrantStmt: GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_
; ;
RevokeStmt: REVOKE privileges ON privilege_target FROM grantee_list opt_drop_behavior RevokeStmt: REVOKE privileges ON privilege_target FROM grantee_list opt_drop_behavior
{ {$$ = cat_str(7, make_str("revoke"), $2, make_str("on"), $4, make_str("from"), $6, $7); }
$$ = cat_str(7, make_str("revoke"), $2, make_str("on"), $4, make_str("from"), $6, $7);
}
| REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_drop_behavior | REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_drop_behavior
{ {$$ = cat_str(7, make_str("revoke grant option for"), $5, make_str("on"), $7, make_str("from"), $9, $10); }
$$ = cat_str(7, make_str("revoke grant option for"), $5, make_str("on"), $7, make_str("from"), $9, $10);
}
; ;
privileges: ALL PRIVILEGES { $$ = make_str("all privileges"); } privileges: ALL PRIVILEGES { $$ = make_str("all privileges"); }
@@ -3006,7 +2991,6 @@ ExecuteStmt: EXECUTE name execute_param_clause
{ $$ = cat_str(3, make_str("execute"), $2, $3); } { $$ = cat_str(3, make_str("execute"), $2, $3); }
| CREATE OptTemp TABLE qualified_name OptCreateAs AS EXECUTE name execute_param_clause | CREATE OptTemp TABLE qualified_name OptCreateAs AS EXECUTE name execute_param_clause
{ $$ = cat_str(8, make_str("create"), $2, make_str("table"), $4, $5, make_str("as execute"), $8, $9); } { $$ = cat_str(8, make_str("create"), $2, make_str("table"), $4, $5, make_str("as execute"), $8, $9); }
; ;
execute_param_clause: '(' expr_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); } execute_param_clause: '(' expr_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
@@ -3150,10 +3134,13 @@ cursor_options: /* EMPTY */ { $$ = EMPTY; }
| cursor_options NO SCROLL { $$ = cat2_str($1, make_str("no scroll")); } | cursor_options NO SCROLL { $$ = cat2_str($1, make_str("no scroll")); }
; ;
opt_hold: /* EMPTY */ { if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true) opt_hold: /* EMPTY */
{
if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true)
$$ = make_str("with hold"); $$ = make_str("with hold");
else else
$$ = EMPTY; } $$ = EMPTY;
}
| WITH HOLD { $$ = make_str("with hold"); } | WITH HOLD { $$ = make_str("with hold"); }
| WITHOUT HOLD { $$ = make_str("without hold"); } | WITHOUT HOLD { $$ = make_str("without hold"); }
; ;
@@ -4837,10 +4824,7 @@ type_declaration: S_TYPEDEF
if (($3.type_enum == ECPGt_struct || if (($3.type_enum == ECPGt_struct ||
$3.type_enum == ECPGt_union) && $3.type_enum == ECPGt_union) &&
initializer == 1) initializer == 1)
{
mmerror(PARSE_ERROR, ET_ERROR, "Initializer not allowed in typedef command"); mmerror(PARSE_ERROR, ET_ERROR, "Initializer not allowed in typedef command");
}
else else
{ {
for (ptr = types; ptr != NULL; ptr = ptr->next) for (ptr = types; ptr != NULL; ptr = ptr->next)
@@ -4914,17 +4898,9 @@ var_declaration: storage_declaration
; ;
storage_declaration: storage_clause storage_modifier storage_declaration: storage_clause storage_modifier
{ {$$ = cat2_str ($1, $2); }
$$ = cat2_str ($1, $2); | storage_clause {$$ = $1; }
} | storage_modifier {$$ = $1; }
| storage_clause
{
$$ = $1;
}
| storage_modifier
{
$$ = $1;
}
; ;
storage_clause : S_EXTERN { $$ = make_str("extern"); } storage_clause : S_EXTERN { $$ = make_str("extern"); }
@@ -5508,6 +5484,7 @@ UsingConst: AllConst
ECPGPrepare: PREPARE prepared_name FROM execstring ECPGPrepare: PREPARE prepared_name FROM execstring
{ $$ = cat_str(3, $2, make_str(","), $4); } { $$ = cat_str(3, $2, make_str(","), $4); }
; ;
/* /*
* We accept descibe but do nothing with it so far. * We accept descibe but do nothing with it so far.
*/ */
@@ -5548,7 +5525,8 @@ ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
{ {
add_descriptor($3,connection); add_descriptor($3,connection);
$$ = $3; $$ = $3;
}; }
;
/* /*
@@ -6066,8 +6044,7 @@ ECPGunreserved_interval: DAY_P { $$ = make_str("day"); }
; ;
/* The following symbol must be excluded from var_name but still included in ColId /* The following symbol must be excluded from var_name but still included in ColId
to enable ecpg special postgresql variables with this name: to enable ecpg special postgresql variables with this name: CONNECTION
CONNECTION
*/ */
ECPGunreserved: ECPGunreserved_con { $$ = $1; } ECPGunreserved: ECPGunreserved_con { $$ = $1; }
| CONNECTION { $$ = make_str("connection"); } | CONNECTION { $$ = make_str("connection"); }
@@ -6493,22 +6470,25 @@ cvariable: CVARIABLE
{ {
switch (*ptr) switch (*ptr)
{ {
case '[': if (brace) case '[':
{ if (brace)
mmerror(PARSE_ERROR, ET_FATAL, "No multidimensional array support for simple data types"); mmerror(PARSE_ERROR, ET_FATAL, "No multidimensional array support for simple data types");
}
brace_open++; brace_open++;
break; break;
case ']': brace_open--; case ']':
if (brace_open == 0) brace = true; brace_open--;
if (brace_open == 0)
brace = true;
break; break;
case '\t': case '\t':
case ' ': break; case ' ':
default: if (brace_open == 0) brace = false; break;
default:
if (brace_open == 0)
brace = false;
break; break;
} }
} }
$$ = $1; $$ = $1;
} }
; ;