mirror of
https://github.com/postgres/postgres.git
synced 2025-08-18 12:22:09 +03:00
Sorry for posting it here again, but I haven't corrected my
subscriptions yet. It's just a small patch to ecpg to keep it in sync with gram.y. Michael
This commit is contained in:
@@ -366,3 +366,9 @@ Tue Dec 22 14:16:11 CET 1998
|
|||||||
|
|
||||||
- Synced preproc.y with gram.y for locking statements.
|
- Synced preproc.y with gram.y for locking statements.
|
||||||
- Set version to 2.4.5
|
- Set version to 2.4.5
|
||||||
|
|
||||||
|
Tue Jan 7 15:19:34 CET 1999
|
||||||
|
|
||||||
|
- Synced preproc.y with gram.y for for-update clause and changes in
|
||||||
|
handling of numerics
|
||||||
|
- Set version to 2.4.6
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "catalog/catname.h"
|
#include "catalog/catname.h"
|
||||||
|
#include "utils/numeric.h"
|
||||||
|
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
@@ -648,7 +649,7 @@ output_statement(char * stmt, int mode)
|
|||||||
%type <str> def_elem def_list definition def_name def_type DefineStmt
|
%type <str> def_elem def_list definition def_name def_type DefineStmt
|
||||||
%type <str> opt_instead event event_object OptStmtMulti OptStmtBlock
|
%type <str> opt_instead event event_object OptStmtMulti OptStmtBlock
|
||||||
%type <str> OptStmtList RuleStmt opt_column opt_name oper_argtypes
|
%type <str> OptStmtList RuleStmt opt_column opt_name oper_argtypes
|
||||||
%type <str> MathOp RemoveFuncStmt aggr_argtype
|
%type <str> MathOp RemoveFuncStmt aggr_argtype for_update_clause
|
||||||
%type <str> RemoveAggrStmt remove_type RemoveStmt ExtendStmt RecipeStmt
|
%type <str> RemoveAggrStmt remove_type RemoveStmt ExtendStmt RecipeStmt
|
||||||
%type <str> RemoveOperStmt RenameStmt all_Op user_valid_clause
|
%type <str> RemoveOperStmt RenameStmt all_Op user_valid_clause
|
||||||
%type <str> VariableSetStmt var_value zone_value VariableShowStmt
|
%type <str> VariableSetStmt var_value zone_value VariableShowStmt
|
||||||
@@ -2611,9 +2612,18 @@ opt_of: OF columnList { $$ = make2_str(make1_str("of"), $2); }
|
|||||||
SelectStmt: SELECT opt_unique res_target_list2
|
SelectStmt: SELECT opt_unique res_target_list2
|
||||||
result from_clause where_clause
|
result from_clause where_clause
|
||||||
group_clause having_clause
|
group_clause having_clause
|
||||||
union_clause sort_clause
|
union_clause sort_clause for_update_clause
|
||||||
{
|
{
|
||||||
$$ = cat2_str(cat5_str(cat5_str(make1_str("select"), $2, $3, $4, $5), $6, $7, $8, $9), $10);
|
$$ = cat3_str(cat5_str(cat5_str(make1_str("select"), $2, $3, $4, $5), $6, $7, $8, $9), $10, $11);
|
||||||
|
if (strlen($11) > 0)
|
||||||
|
{
|
||||||
|
if (strlen($9) > 0)
|
||||||
|
yyerror("SELECT FOR UPDATE is not allowed with UNION clause");
|
||||||
|
if (strlen($7) > 0)
|
||||||
|
yyerror("SELECT FOR UPDATE is not allowed with GROUP BY clause");
|
||||||
|
if (strlen($6) > 0)
|
||||||
|
yyerror("SELECT FOR UPDATE is not allowed with HAVING clause");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -2721,6 +2731,20 @@ having_clause: HAVING a_expr
|
|||||||
| /*EMPTY*/ { $$ = make1_str(""); }
|
| /*EMPTY*/ { $$ = make1_str(""); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
for_update_clause:
|
||||||
|
FOR UPDATE
|
||||||
|
{
|
||||||
|
$$ = make1_str("for update");
|
||||||
|
}
|
||||||
|
| FOR UPDATE OF va_list
|
||||||
|
{
|
||||||
|
$$ = cat2_str(make1_str("for update of"), $4);
|
||||||
|
}
|
||||||
|
| /* EMPTY */
|
||||||
|
{
|
||||||
|
$$ = make1_str("");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
@@ -2897,8 +2921,7 @@ generic: ident { $$ = $1; }
|
|||||||
|
|
||||||
/* SQL92 numeric data types
|
/* SQL92 numeric data types
|
||||||
* Check FLOAT() precision limits assuming IEEE floating types.
|
* Check FLOAT() precision limits assuming IEEE floating types.
|
||||||
* Provide rudimentary DECIMAL() and NUMERIC() implementations
|
* Provide real DECIMAL() and NUMERIC() implementations now - Jan 1998-12-30
|
||||||
* by checking parameters and making sure they match what is possible with INTEGER.
|
|
||||||
* - thomas 1997-09-18
|
* - thomas 1997-09-18
|
||||||
*/
|
*/
|
||||||
Numeric: FLOAT opt_float
|
Numeric: FLOAT opt_float
|
||||||
@@ -2945,20 +2968,20 @@ opt_float: '(' Iconst ')'
|
|||||||
|
|
||||||
opt_numeric: '(' Iconst ',' Iconst ')'
|
opt_numeric: '(' Iconst ',' Iconst ')'
|
||||||
{
|
{
|
||||||
if (atol($2) != 9) {
|
if (atol($2) < 1 || atol($2) > NUMERIC_MAX_PRECISION) {
|
||||||
sprintf(errortext, make1_str("NUMERIC precision %s must be 9"), $2);
|
sprintf(errortext, "NUMERIC precision %s must be between 1 and %d", $2, NUMERIC_MAX_PRECISION);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
if (atol($4) != 0) {
|
if (atol($4) < 0 || atol($4) > atol($2)) {
|
||||||
sprintf(errortext, "NUMERIC scale %s must be zero", $4);
|
sprintf(errortext, "NUMERIC scale %s must be between 0 and precision %s", $4, $2);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
$$ = cat3_str(make2_str(make1_str("("), $2), make1_str(","), make2_str($4, make1_str(")")));
|
$$ = cat3_str(make2_str(make1_str("("), $2), make1_str(","), make2_str($4, make1_str(")")));
|
||||||
}
|
}
|
||||||
| '(' Iconst ')'
|
| '(' Iconst ')'
|
||||||
{
|
{
|
||||||
if (atol($2) != 9) {
|
if (atol($2) < 1 || atol($2) > NUMERIC_MAX_PRECISION) {
|
||||||
sprintf("NUMERIC precision %s must be 9",$2);
|
sprintf(errortext, "NUMERIC precision %s must be between 1 and %d", $2, NUMERIC_MAX_PRECISION);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
$$ = make3_str(make1_str("("), $2, make1_str(")"));
|
$$ = make3_str(make1_str("("), $2, make1_str(")"));
|
||||||
@@ -2971,20 +2994,20 @@ opt_numeric: '(' Iconst ',' Iconst ')'
|
|||||||
|
|
||||||
opt_decimal: '(' Iconst ',' Iconst ')'
|
opt_decimal: '(' Iconst ',' Iconst ')'
|
||||||
{
|
{
|
||||||
if (atol($2) != 9) {
|
if (atol($2) < 1 || atol($2) > NUMERIC_MAX_PRECISION) {
|
||||||
sprintf(errortext, "DECIMAL precision %s exceeds implementation limit of 9", $2);
|
sprintf(errortext, "NUMERIC precision %s must be between 1 and %d", $2, NUMERIC_MAX_PRECISION);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
if (atol($4) != 0) {
|
if (atol($4) < 0 || atol($4) > atol($2)) {
|
||||||
sprintf(errortext, "DECIMAL scale %s must be zero",$4);
|
sprintf(errortext, "NUMERIC scale %s must be between 0 and precision %s", $4, $2);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
$$ = cat3_str(make2_str(make1_str("("), $2), make1_str(","), make2_str($4, make1_str(")")));
|
$$ = cat3_str(make2_str(make1_str("("), $2), make1_str(","), make2_str($4, make1_str(")")));
|
||||||
}
|
}
|
||||||
| '(' Iconst ')'
|
| '(' Iconst ')'
|
||||||
{
|
{
|
||||||
if (atol($2) != 9) {
|
if (atol($2) < 1 || atol($2) > NUMERIC_MAX_PRECISION) {
|
||||||
sprintf(errortext, "DECIMAL precision %s exceeds implementation limit of 9",$2);
|
sprintf(errortext, "NUMERIC precision %s must be between 1 and %d", $2, NUMERIC_MAX_PRECISION);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
$$ = make3_str(make1_str("("), $2, make1_str(")"));
|
$$ = make3_str(make1_str("("), $2, make1_str(")"));
|
||||||
|
Reference in New Issue
Block a user