mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 01:21:48 +03:00
Set valid return values even in case of an error to prevent segfaults.
This commit is contained in:
parent
b775d93acb
commit
1460c82151
@ -2288,6 +2288,11 @@ Sun, 13 Jan 2008 12:52:15 +0100
|
||||
|
||||
- Changed prototype for ECPGdo because some compilers don't like
|
||||
int/enum aliasing in there.
|
||||
|
||||
Mon, 14 Jan 2008 10:42:23 +0100
|
||||
|
||||
- Set valid return values even in case of an error to prevent
|
||||
segfaults.
|
||||
- Set pgtypes library version to 3.0.
|
||||
- Set compat library version to 3.0.
|
||||
- Set ecpg library version to 6.0.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.357 2007/12/28 11:25:21 meskes Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.358 2008/01/14 09:43:42 meskes Exp $ */
|
||||
|
||||
/* Copyright comment */
|
||||
%{
|
||||
@ -1288,7 +1288,10 @@ VariableShowStmt: SHOW var_name ecpg_into
|
||||
| SHOW SESSION AUTHORIZATION ecpg_into
|
||||
{ $$ = make_str("show session authorization"); }
|
||||
| SHOW ALL
|
||||
{ mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL not implemented"); }
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL not implemented");
|
||||
$$ = EMPTY;
|
||||
}
|
||||
;
|
||||
|
||||
VariableResetStmt: RESET var_name
|
||||
@ -2340,19 +2343,28 @@ fetch_direction: NEXT { $$ = make_str("next"); }
|
||||
| LAST_P { $$ = make_str("last"); }
|
||||
| ABSOLUTE_P IntConst {
|
||||
if ($2[1] == '$')
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable, ignoring it.\n");
|
||||
$$ = make_str("absolute");
|
||||
}
|
||||
else
|
||||
$$ = cat2_str(make_str("absolute"), $2);
|
||||
}
|
||||
| RELATIVE_P IntConst {
|
||||
if ($2[1] == '$')
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable, ignoring it.\n");
|
||||
$$ = make_str("relative");
|
||||
}
|
||||
else
|
||||
$$ = cat2_str(make_str("relative"), $2);
|
||||
}
|
||||
| IntConst {
|
||||
if ($1[1] == '$')
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variablei, ignoring it.\n");
|
||||
$$ = EMPTY;
|
||||
}
|
||||
else
|
||||
$$ = $1;
|
||||
}
|
||||
@ -2360,7 +2372,10 @@ fetch_direction: NEXT { $$ = make_str("next"); }
|
||||
| FORWARD { $$ = make_str("forward"); }
|
||||
| FORWARD IntConst {
|
||||
if ($2[1] == '$')
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable, ignoring it.\n");
|
||||
$$ = make_str("forward");
|
||||
}
|
||||
else
|
||||
$$ = cat2_str(make_str("forward"), $2);
|
||||
}
|
||||
@ -2368,7 +2383,10 @@ fetch_direction: NEXT { $$ = make_str("next"); }
|
||||
| BACKWARD { $$ = make_str("backward"); }
|
||||
| BACKWARD IntConst {
|
||||
if ($2[1] == '$')
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable.\n");
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "fetch/move count must not be a variable, ignoring it.\n");
|
||||
$$ = make_str("backward");
|
||||
}
|
||||
else
|
||||
$$ = cat2_str(make_str("backward"), $2);
|
||||
}
|
||||
@ -2744,7 +2762,10 @@ RemoveOperStmt: DROP OPERATOR all_Op '(' oper_argtypes ')' opt_drop_behavior
|
||||
;
|
||||
|
||||
oper_argtypes: Typename
|
||||
{ mmerror(PARSE_ERROR, ET_ERROR, "parser: argument type missing (use NONE for unary operators)"); }
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "parser: argument type missing (use NONE for unary operators)");
|
||||
$$ = make_str("none");
|
||||
}
|
||||
| Typename ',' Typename
|
||||
{ $$ = cat_str(3, $1, make_str(","), $3); }
|
||||
| NONE ',' Typename /* left unary */
|
||||
@ -3665,7 +3686,10 @@ select_limit: LIMIT select_limit_value OFFSET select_offset_value
|
||||
| OFFSET select_offset_value
|
||||
{ $$ = cat2_str(make_str("offset"), $2); }
|
||||
| LIMIT select_limit_value ',' select_offset_value
|
||||
{ mmerror(PARSE_ERROR, ET_WARNING, "No longer supported LIMIT #,# syntax passed to backend."); }
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_WARNING, "No longer supported LIMIT #,# syntax passed to backend.");
|
||||
$$ = cat_str(4, make_str("limit"), $2, make_str(","), $4);
|
||||
}
|
||||
;
|
||||
|
||||
opt_select_limit: select_limit { $$ = $1; }
|
||||
@ -3769,7 +3793,10 @@ table_ref: relation_expr
|
||||
| func_table ColId '(' TableFuncElementList ')'
|
||||
{ $$ = cat_str(5, $1, $2, make_str("("), $4, make_str(")")); }
|
||||
| select_with_parens
|
||||
{mmerror(PARSE_ERROR, ET_ERROR, "sub-SELECT in FROM must have an alias");}
|
||||
{
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "sub-SELECT in FROM must have an alias");
|
||||
$$ = $1;
|
||||
}
|
||||
| select_with_parens alias_clause
|
||||
{ $$ = cat2_str($1, $2); }
|
||||
| joined_table
|
||||
@ -5159,6 +5186,7 @@ char_variable: cvariable
|
||||
break;
|
||||
default:
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "invalid datatype");
|
||||
$$ = $1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user