mirror of
https://github.com/postgres/postgres.git
synced 2025-05-13 01:13:08 -04:00
Partial pgindent of .l and .y files
Trying to clean up the code a bit while we're working on these files for the reentrant scanner/pure parser patches. This cleanup only touches the code sections after the second '%%' in each file, via a manually-supervised and locally hacked up pgindent.
This commit is contained in:
parent
2571c1d5cc
commit
301de6a6f6
@ -244,8 +244,8 @@ write_box(int dim, char *str1, char *str2,
|
||||
* The value turned out to be a point, ie. all the upper-right
|
||||
* coordinates were equal to the lower-left coordinates. Resize the
|
||||
* cube we constructed. Note: we don't bother to repalloc() it
|
||||
* smaller, as it's unlikely that the tiny amount of memory freed
|
||||
* that way would be useful, and the output is always short-lived.
|
||||
* smaller, as it's unlikely that the tiny amount of memory freed that
|
||||
* way would be useful, and the output is always short-lived.
|
||||
*/
|
||||
size = POINT_SIZE(dim);
|
||||
SET_VARSIZE(bp, size);
|
||||
|
@ -73,7 +73,8 @@ cube_yyerror(NDBOX **result, Size scanbuflen,
|
||||
yyscan_t yyscanner,
|
||||
const char *message)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t *) yyscanner; /* needed for yytext macro */
|
||||
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
|
||||
* macro */
|
||||
|
||||
if (*yytext == YY_END_OF_BUFFER_CHAR)
|
||||
{
|
||||
|
@ -66,7 +66,8 @@ float ({integer}|{real})([eE]{integer})?
|
||||
void
|
||||
seg_yyerror(SEG *result, struct Node *escontext, yyscan_t yyscanner, const char *message)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t *) yyscanner; /* needed for yytext macro */
|
||||
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
|
||||
* macro */
|
||||
|
||||
/* if we already reported an error, don't overwrite it */
|
||||
if (SOFT_ERROR_OCCURRED(escontext))
|
||||
|
@ -131,7 +131,8 @@ NULL { yylval->kw = "NULL"; return XNULL; }
|
||||
void
|
||||
boot_yyerror(yyscan_t yyscanner, const char *message)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t *) yyscanner; /* needed for yylineno macro */
|
||||
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yylineno
|
||||
* macro */
|
||||
|
||||
elog(ERROR, "%s at line %d", message, yylineno);
|
||||
}
|
||||
|
@ -18646,31 +18646,31 @@ updatePreparableStmtEnd(Node *n, int end_location)
|
||||
{
|
||||
if (IsA(n, SelectStmt))
|
||||
{
|
||||
SelectStmt *stmt = (SelectStmt *)n;
|
||||
SelectStmt *stmt = (SelectStmt *) n;
|
||||
|
||||
stmt->stmt_len = end_location - stmt->stmt_location;
|
||||
}
|
||||
else if (IsA(n, InsertStmt))
|
||||
{
|
||||
InsertStmt *stmt = (InsertStmt *)n;
|
||||
InsertStmt *stmt = (InsertStmt *) n;
|
||||
|
||||
stmt->stmt_len = end_location - stmt->stmt_location;
|
||||
}
|
||||
else if (IsA(n, UpdateStmt))
|
||||
{
|
||||
UpdateStmt *stmt = (UpdateStmt *)n;
|
||||
UpdateStmt *stmt = (UpdateStmt *) n;
|
||||
|
||||
stmt->stmt_len = end_location - stmt->stmt_location;
|
||||
}
|
||||
else if (IsA(n, DeleteStmt))
|
||||
{
|
||||
DeleteStmt *stmt = (DeleteStmt *)n;
|
||||
DeleteStmt *stmt = (DeleteStmt *) n;
|
||||
|
||||
stmt->stmt_len = end_location - stmt->stmt_location;
|
||||
}
|
||||
else if (IsA(n, MergeStmt))
|
||||
{
|
||||
MergeStmt *stmt = (MergeStmt *)n;
|
||||
MergeStmt *stmt = (MergeStmt *) n;
|
||||
|
||||
stmt->stmt_len = end_location - stmt->stmt_location;
|
||||
}
|
||||
@ -18683,10 +18683,10 @@ makeColumnRef(char *colname, List *indirection,
|
||||
int location, core_yyscan_t yyscanner)
|
||||
{
|
||||
/*
|
||||
* Generate a ColumnRef node, with an A_Indirection node added if there
|
||||
* is any subscripting in the specified indirection list. However,
|
||||
* any field selection at the start of the indirection list must be
|
||||
* transposed into the "fields" part of the ColumnRef node.
|
||||
* Generate a ColumnRef node, with an A_Indirection node added if there is
|
||||
* any subscripting in the specified indirection list. However, any field
|
||||
* selection at the start of the indirection list must be transposed into
|
||||
* the "fields" part of the ColumnRef node.
|
||||
*/
|
||||
ColumnRef *c = makeNode(ColumnRef);
|
||||
int nfields = 0;
|
||||
@ -18952,8 +18952,8 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
|
||||
FunctionParameter *firsto = (FunctionParameter *) linitial(orderedargs);
|
||||
|
||||
/*
|
||||
* We ignore the names, though the aggr_arg production allows them;
|
||||
* it doesn't allow default values, so those need not be checked.
|
||||
* We ignore the names, though the aggr_arg production allows them; it
|
||||
* doesn't allow default values, so those need not be checked.
|
||||
*/
|
||||
if (list_length(orderedargs) != 1 ||
|
||||
firsto->mode != FUNC_PARAM_VARIADIC ||
|
||||
@ -19143,7 +19143,7 @@ doNegateFloat(Float *v)
|
||||
if (*oldval == '+')
|
||||
oldval++;
|
||||
if (*oldval == '-')
|
||||
v->fval = oldval+1; /* just strip the '-' */
|
||||
v->fval = oldval + 1; /* just strip the '-' */
|
||||
else
|
||||
v->fval = psprintf("-%s", oldval);
|
||||
}
|
||||
@ -19218,6 +19218,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
|
||||
|
||||
x->op = op;
|
||||
x->name = name;
|
||||
|
||||
/*
|
||||
* named_args is a list of ResTarget; it'll be split apart into separate
|
||||
* expression and name lists in transformXmlExpr().
|
||||
@ -19556,8 +19557,8 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
|
||||
parser_errposition(pubobj->location));
|
||||
|
||||
/*
|
||||
* We can distinguish between the different type of schema
|
||||
* objects based on whether name and pubtable is set.
|
||||
* We can distinguish between the different type of schema objects
|
||||
* based on whether name and pubtable is set.
|
||||
*/
|
||||
if (pubobj->name)
|
||||
pubobj->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA;
|
||||
@ -19612,9 +19613,11 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
|
||||
w->ctes = list_make1(cte);
|
||||
w->location = -1;
|
||||
|
||||
/* create target list for the new SELECT from the alias list of the
|
||||
* recursive view specification */
|
||||
foreach (lc, aliases)
|
||||
/*
|
||||
* create target list for the new SELECT from the alias list of the
|
||||
* recursive view specification
|
||||
*/
|
||||
foreach(lc, aliases)
|
||||
{
|
||||
ResTarget *rt = makeNode(ResTarget);
|
||||
|
||||
@ -19626,8 +19629,10 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
|
||||
tl = lappend(tl, rt);
|
||||
}
|
||||
|
||||
/* create new SELECT combining WITH clause, target list, and fake FROM
|
||||
* clause */
|
||||
/*
|
||||
* create new SELECT combining WITH clause, target list, and fake FROM
|
||||
* clause
|
||||
*/
|
||||
s->withClause = w;
|
||||
s->targetList = tl;
|
||||
s->fromClause = list_make1(makeRangeVar(NULL, relname, -1));
|
||||
|
@ -140,7 +140,8 @@ xdinside [^"]+
|
||||
void
|
||||
syncrep_yyerror(yyscan_t yyscanner, const char *message)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t *) yyscanner; /* needed for yytext macro */
|
||||
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
|
||||
* macro */
|
||||
|
||||
/* report only the first error in a parse operation */
|
||||
if (syncrep_parse_error_msg)
|
||||
|
@ -562,7 +562,7 @@ makeAny(int first, int last)
|
||||
|
||||
static bool
|
||||
makeItemLikeRegex(JsonPathParseItem *expr, JsonPathString *pattern,
|
||||
JsonPathString *flags, JsonPathParseItem ** result,
|
||||
JsonPathString *flags, JsonPathParseItem **result,
|
||||
struct Node *escontext)
|
||||
{
|
||||
JsonPathParseItem *v = makeItemType(jpiLikeRegex);
|
||||
@ -605,7 +605,7 @@ makeItemLikeRegex(JsonPathParseItem *expr, JsonPathString *pattern,
|
||||
}
|
||||
|
||||
/* Convert flags to what pg_regcomp needs */
|
||||
if ( !jspConvertRegexFlags(v->value.like_regex.flags, &cflags, escontext))
|
||||
if (!jspConvertRegexFlags(v->value.like_regex.flags, &cflags, escontext))
|
||||
return false;
|
||||
|
||||
/* check regex validity */
|
||||
|
@ -363,7 +363,8 @@ jsonpath_yyerror(JsonPathParseResult **result, struct Node *escontext,
|
||||
yyscan_t yyscanner,
|
||||
const char *message)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t *) yyscanner; /* needed for yytext macro */
|
||||
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
|
||||
* macro */
|
||||
|
||||
/* don't overwrite escontext if it's already been set */
|
||||
if (SOFT_ERROR_OCCURRED(escontext))
|
||||
@ -399,39 +400,39 @@ typedef struct JsonPathKeyword
|
||||
* alphabetical order
|
||||
*/
|
||||
static const JsonPathKeyword keywords[] = {
|
||||
{ 2, false, IS_P, "is"},
|
||||
{ 2, false, TO_P, "to"},
|
||||
{ 3, false, ABS_P, "abs"},
|
||||
{ 3, false, LAX_P, "lax"},
|
||||
{ 4, false, DATE_P, "date"},
|
||||
{ 4, false, FLAG_P, "flag"},
|
||||
{ 4, false, LAST_P, "last"},
|
||||
{ 4, true, NULL_P, "null"},
|
||||
{ 4, false, SIZE_P, "size"},
|
||||
{ 4, false, TIME_P, "time"},
|
||||
{ 4, true, TRUE_P, "true"},
|
||||
{ 4, false, TYPE_P, "type"},
|
||||
{ 4, false, WITH_P, "with"},
|
||||
{ 5, true, FALSE_P, "false"},
|
||||
{ 5, false, FLOOR_P, "floor"},
|
||||
{ 6, false, BIGINT_P, "bigint"},
|
||||
{ 6, false, DOUBLE_P, "double"},
|
||||
{ 6, false, EXISTS_P, "exists"},
|
||||
{ 6, false, NUMBER_P, "number"},
|
||||
{ 6, false, STARTS_P, "starts"},
|
||||
{ 6, false, STRICT_P, "strict"},
|
||||
{ 6, false, STRINGFUNC_P, "string"},
|
||||
{ 7, false, BOOLEAN_P, "boolean"},
|
||||
{ 7, false, CEILING_P, "ceiling"},
|
||||
{ 7, false, DECIMAL_P, "decimal"},
|
||||
{ 7, false, INTEGER_P, "integer"},
|
||||
{ 7, false, TIME_TZ_P, "time_tz"},
|
||||
{ 7, false, UNKNOWN_P, "unknown"},
|
||||
{ 8, false, DATETIME_P, "datetime"},
|
||||
{ 8, false, KEYVALUE_P, "keyvalue"},
|
||||
{ 9, false, TIMESTAMP_P, "timestamp"},
|
||||
{ 10,false, LIKE_REGEX_P, "like_regex"},
|
||||
{ 12,false, TIMESTAMP_TZ_P, "timestamp_tz"},
|
||||
{2, false, IS_P, "is"},
|
||||
{2, false, TO_P, "to"},
|
||||
{3, false, ABS_P, "abs"},
|
||||
{3, false, LAX_P, "lax"},
|
||||
{4, false, DATE_P, "date"},
|
||||
{4, false, FLAG_P, "flag"},
|
||||
{4, false, LAST_P, "last"},
|
||||
{4, true, NULL_P, "null"},
|
||||
{4, false, SIZE_P, "size"},
|
||||
{4, false, TIME_P, "time"},
|
||||
{4, true, TRUE_P, "true"},
|
||||
{4, false, TYPE_P, "type"},
|
||||
{4, false, WITH_P, "with"},
|
||||
{5, true, FALSE_P, "false"},
|
||||
{5, false, FLOOR_P, "floor"},
|
||||
{6, false, BIGINT_P, "bigint"},
|
||||
{6, false, DOUBLE_P, "double"},
|
||||
{6, false, EXISTS_P, "exists"},
|
||||
{6, false, NUMBER_P, "number"},
|
||||
{6, false, STARTS_P, "starts"},
|
||||
{6, false, STRICT_P, "strict"},
|
||||
{6, false, STRINGFUNC_P, "string"},
|
||||
{7, false, BOOLEAN_P, "boolean"},
|
||||
{7, false, CEILING_P, "ceiling"},
|
||||
{7, false, DECIMAL_P, "decimal"},
|
||||
{7, false, INTEGER_P, "integer"},
|
||||
{7, false, TIME_TZ_P, "time_tz"},
|
||||
{7, false, UNKNOWN_P, "unknown"},
|
||||
{8, false, DATETIME_P, "datetime"},
|
||||
{8, false, KEYVALUE_P, "keyvalue"},
|
||||
{9, false, TIMESTAMP_P, "timestamp"},
|
||||
{10, false, LIKE_REGEX_P, "like_regex"},
|
||||
{12, false, TIMESTAMP_TZ_P, "timestamp_tz"},
|
||||
};
|
||||
|
||||
/*
|
||||
@ -593,7 +594,7 @@ addUnicodeChar(int ch, struct Node *escontext, yyscan_t yyscanner)
|
||||
* more detailed errors.
|
||||
*/
|
||||
|
||||
if (! escontext || ! IsA(escontext, ErrorSaveContext))
|
||||
if (!escontext || !IsA(escontext, ErrorSaveContext))
|
||||
pg_unicode_to_server(ch, (unsigned char *) cbuf);
|
||||
else if (!pg_unicode_to_server_noerror(ch, (unsigned char *) cbuf))
|
||||
ereturn(escontext, false,
|
||||
@ -655,7 +656,8 @@ parseUnicode(char *s, int l, struct Node *escontext, yyscan_t yyscanner)
|
||||
for (i = 2; i < l; i += 2) /* skip '\u' */
|
||||
{
|
||||
int ch = 0;
|
||||
int j, si;
|
||||
int j,
|
||||
si;
|
||||
|
||||
if (s[i] == '{') /* parse '\u{XX...}' */
|
||||
{
|
||||
@ -677,7 +679,7 @@ parseUnicode(char *s, int l, struct Node *escontext, yyscan_t yyscanner)
|
||||
}
|
||||
}
|
||||
|
||||
if (! addUnicode(ch, &hi_surrogate, escontext, yyscanner))
|
||||
if (!addUnicode(ch, &hi_surrogate, escontext, yyscanner))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -697,7 +699,10 @@ parseUnicode(char *s, int l, struct Node *escontext, yyscan_t yyscanner)
|
||||
static bool
|
||||
parseHexChar(char *s, struct Node *escontext, yyscan_t yyscanner)
|
||||
{
|
||||
int s2, s3, ch;
|
||||
int s2,
|
||||
s3,
|
||||
ch;
|
||||
|
||||
if (!hexval(s[2], &s2, escontext, yyscanner))
|
||||
return false;
|
||||
if (!hexval(s[3], &s3, escontext, yyscanner))
|
||||
|
@ -253,6 +253,7 @@ static const struct
|
||||
int nargs;
|
||||
PgBenchFunction tag;
|
||||
} PGBENCH_FUNCTIONS[] =
|
||||
|
||||
{
|
||||
/* parsed as operators, executed as functions */
|
||||
{
|
||||
@ -485,6 +486,7 @@ make_func(yyscan_t yyscanner, int fnumber, PgBenchExprList *args)
|
||||
if (len == 1)
|
||||
{
|
||||
PgBenchExpr *var = make_variable("default_seed");
|
||||
|
||||
args = make_elist(var, args);
|
||||
}
|
||||
break;
|
||||
@ -498,6 +500,7 @@ make_func(yyscan_t yyscanner, int fnumber, PgBenchExprList *args)
|
||||
if (len == 2)
|
||||
{
|
||||
PgBenchExpr *var = make_variable("default_seed");
|
||||
|
||||
args = make_elist(var, args);
|
||||
}
|
||||
break;
|
||||
|
@ -598,9 +598,9 @@ psql_scan_slash_option(PsqlScanState state,
|
||||
psql_scan_reselect_sql_lexer(state);
|
||||
|
||||
/*
|
||||
* Check the lex result: we should have gotten back either LEXRES_OK
|
||||
* or LEXRES_EOL (the latter indicating end of string). If we were inside
|
||||
* a quoted string, as indicated by final_state, EOL is an error.
|
||||
* Check the lex result: we should have gotten back either LEXRES_OK or
|
||||
* LEXRES_EOL (the latter indicating end of string). If we were inside a
|
||||
* quoted string, as indicated by final_state, EOL is an error.
|
||||
*/
|
||||
Assert(lexresult == LEXRES_EOL || lexresult == LEXRES_OK);
|
||||
|
||||
@ -642,6 +642,7 @@ psql_scan_slash_option(PsqlScanState state,
|
||||
termPQExpBuffer(&mybuf);
|
||||
return NULL;
|
||||
case xslashwholeline:
|
||||
|
||||
/*
|
||||
* In whole-line mode, we interpret semicolon = true as stripping
|
||||
* trailing whitespace as well as semicolons; this gives the
|
||||
|
@ -1847,9 +1847,9 @@ isdefine(void)
|
||||
ptr->used = yb;
|
||||
|
||||
/*
|
||||
* We use yy_scan_string which will copy the value, so there's
|
||||
* no need to worry about a possible undef happening while we
|
||||
* are still scanning it.
|
||||
* We use yy_scan_string which will copy the value, so there's no
|
||||
* need to worry about a possible undef happening while we are
|
||||
* still scanning it.
|
||||
*/
|
||||
yy_scan_string(ptr->value);
|
||||
return true;
|
||||
|
@ -2723,10 +2723,11 @@ read_sql_construct(int until,
|
||||
if (parenlevel < 0)
|
||||
yyerror("mismatched parentheses");
|
||||
}
|
||||
|
||||
/*
|
||||
* End of function definition is an error, and we don't expect to
|
||||
* hit a semicolon either (unless it's the until symbol, in which
|
||||
* case we should have fallen out above).
|
||||
* End of function definition is an error, and we don't expect to hit
|
||||
* a semicolon either (unless it's the until symbol, in which case we
|
||||
* should have fallen out above).
|
||||
*/
|
||||
if (tok == 0 || tok == ';')
|
||||
{
|
||||
@ -2983,8 +2984,8 @@ make_execsql_stmt(int firsttoken, int location, PLword *word)
|
||||
plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_EXPR;
|
||||
|
||||
/*
|
||||
* Scan to the end of the SQL command. Identify any INTO-variables
|
||||
* clause lurking within it, and parse that via read_into_target().
|
||||
* Scan to the end of the SQL command. Identify any INTO-variables clause
|
||||
* lurking within it, and parse that via read_into_target().
|
||||
*
|
||||
* The end of the statement is defined by a semicolon ... except that
|
||||
* semicolons within parentheses or BEGIN/END blocks don't terminate a
|
||||
@ -3006,12 +3007,12 @@ make_execsql_stmt(int firsttoken, int location, PLword *word)
|
||||
* but it's not very likely.
|
||||
*
|
||||
* 3. IMPORT FOREIGN SCHEMA ... INTO. This is not allowed in CREATE RULE
|
||||
* or WITH, so we just check for IMPORT as the command's first token.
|
||||
* (If IMPORT FOREIGN SCHEMA returned data someone might wish to capture
|
||||
* with an INTO-variables clause, we'd have to work much harder here.)
|
||||
* or WITH, so we just check for IMPORT as the command's first token. (If
|
||||
* IMPORT FOREIGN SCHEMA returned data someone might wish to capture with
|
||||
* an INTO-variables clause, we'd have to work much harder here.)
|
||||
*
|
||||
* Fortunately, INTO is a fully reserved word in the main grammar, so
|
||||
* at least we need not worry about it appearing as an identifier.
|
||||
* Fortunately, INTO is a fully reserved word in the main grammar, so at
|
||||
* least we need not worry about it appearing as an identifier.
|
||||
*
|
||||
* Any future additional uses of INTO in the main grammar will doubtless
|
||||
* break this logic again ... beware!
|
||||
@ -3087,9 +3088,9 @@ make_execsql_stmt(int firsttoken, int location, PLword *word)
|
||||
if (have_into)
|
||||
{
|
||||
/*
|
||||
* Insert an appropriate number of spaces corresponding to the
|
||||
* INTO text, so that locations within the redacted SQL statement
|
||||
* still line up with those in the original source text.
|
||||
* Insert an appropriate number of spaces corresponding to the INTO
|
||||
* text, so that locations within the redacted SQL statement still
|
||||
* line up with those in the original source text.
|
||||
*/
|
||||
plpgsql_append_source_text(&ds, location, into_start_loc);
|
||||
appendStringInfoSpaces(&ds, into_end_loc - into_start_loc);
|
||||
@ -3137,8 +3138,8 @@ read_fetch_direction(void)
|
||||
bool check_FROM = true;
|
||||
|
||||
/*
|
||||
* We create the PLpgSQL_stmt_fetch struct here, but only fill in
|
||||
* the fields arising from the optional direction clause
|
||||
* We create the PLpgSQL_stmt_fetch struct here, but only fill in the
|
||||
* fields arising from the optional direction clause
|
||||
*/
|
||||
fetch = (PLpgSQL_stmt_fetch *) palloc0(sizeof(PLpgSQL_stmt_fetch));
|
||||
fetch->cmd_type = PLPGSQL_STMT_FETCH;
|
||||
@ -3223,12 +3224,12 @@ read_fetch_direction(void)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Assume it's a count expression with no preceding keyword.
|
||||
* Note: we allow this syntax because core SQL does, but it's
|
||||
* ambiguous with the case of an omitted direction clause; for
|
||||
* instance, "MOVE n IN c" will fail if n is a variable, because the
|
||||
* preceding else-arm will trigger. Perhaps this can be improved
|
||||
* someday, but it hardly seems worth a lot of work.
|
||||
* Assume it's a count expression with no preceding keyword. Note: we
|
||||
* allow this syntax because core SQL does, but it's ambiguous with
|
||||
* the case of an omitted direction clause; for instance, "MOVE n IN
|
||||
* c" will fail if n is a variable, because the preceding else-arm
|
||||
* will trigger. Perhaps this can be improved someday, but it hardly
|
||||
* seems worth a lot of work.
|
||||
*/
|
||||
plpgsql_push_back_token(tok);
|
||||
fetch->expr = read_sql_expression2(K_FROM, K_IN,
|
||||
@ -3357,8 +3358,8 @@ make_return_stmt(int location)
|
||||
/*
|
||||
* Not (just) a variable name, so treat as expression.
|
||||
*
|
||||
* Note that a well-formed expression is _required_ here;
|
||||
* anything else is a compile-time error.
|
||||
* Note that a well-formed expression is _required_ here; anything
|
||||
* else is a compile-time error.
|
||||
*/
|
||||
plpgsql_push_back_token(tok);
|
||||
new->expr = read_sql_expression(';', ";");
|
||||
@ -3420,8 +3421,8 @@ make_return_next_stmt(int location)
|
||||
/*
|
||||
* Not (just) a variable name, so treat as expression.
|
||||
*
|
||||
* Note that a well-formed expression is _required_ here;
|
||||
* anything else is a compile-time error.
|
||||
* Note that a well-formed expression is _required_ here; anything
|
||||
* else is a compile-time error.
|
||||
*/
|
||||
plpgsql_push_back_token(tok);
|
||||
new->expr = read_sql_expression(';', ";");
|
||||
@ -3540,11 +3541,11 @@ read_into_target(PLpgSQL_variable **target, bool *strict)
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently, a row or record variable can be the single INTO target,
|
||||
* but not a member of a multi-target list. So we throw error if there
|
||||
* is a comma after it, because that probably means the user tried to
|
||||
* write a multi-target list. If this ever gets generalized, we should
|
||||
* probably refactor read_into_scalar_list so it handles all cases.
|
||||
* Currently, a row or record variable can be the single INTO target, but
|
||||
* not a member of a multi-target list. So we throw error if there is a
|
||||
* comma after it, because that probably means the user tried to write a
|
||||
* multi-target list. If this ever gets generalized, we should probably
|
||||
* refactor read_into_scalar_list so it handles all cases.
|
||||
*/
|
||||
switch (tok)
|
||||
{
|
||||
@ -3630,8 +3631,8 @@ read_into_scalar_list(char *initial_name,
|
||||
}
|
||||
|
||||
/*
|
||||
* We read an extra, non-comma token from yylex(), so push it
|
||||
* back onto the input stream
|
||||
* We read an extra, non-comma token from yylex(), so push it back onto
|
||||
* the input stream
|
||||
*/
|
||||
plpgsql_push_back_token(tok);
|
||||
|
||||
@ -3741,14 +3742,14 @@ plpgsql_sql_error_callback(void *arg)
|
||||
|
||||
/*
|
||||
* First, set up internalerrposition to point to the start of the
|
||||
* statement text within the function text. Note this converts
|
||||
* location (a byte offset) to a character number.
|
||||
* statement text within the function text. Note this converts location
|
||||
* (a byte offset) to a character number.
|
||||
*/
|
||||
parser_errposition(cbarg->location);
|
||||
|
||||
/*
|
||||
* If the core parser provided an error position, transpose it.
|
||||
* Note we are dealing with 1-based character numbers at this point.
|
||||
* If the core parser provided an error position, transpose it. Note we
|
||||
* are dealing with 1-based character numbers at this point.
|
||||
*/
|
||||
errpos = geterrposition();
|
||||
if (errpos > 0)
|
||||
@ -4121,9 +4122,9 @@ make_case(int location, PLpgSQL_expr *t_expr,
|
||||
/*
|
||||
* When test expression is present, we create a var for it and then
|
||||
* convert all the WHEN expressions to "VAR IN (original_expression)".
|
||||
* This is a bit klugy, but okay since we haven't yet done more than
|
||||
* read the expressions as text. (Note that previous parsing won't
|
||||
* have complained if the WHEN ... THEN expression contained multiple
|
||||
* This is a bit klugy, but okay since we haven't yet done more than read
|
||||
* the expressions as text. (Note that previous parsing won't have
|
||||
* complained if the WHEN ... THEN expression contained multiple
|
||||
* comma-separated values.)
|
||||
*/
|
||||
if (t_expr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user