1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +03:00

Phase 3 of pgindent updates.

Don't move parenthesized lines to the left, even if that means they
flow past the right margin.

By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis.  However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent.  That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.

This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@@ -305,7 +305,7 @@ transformStmt(ParseState *pstate, Node *parseTree)
*/
case T_DeclareCursorStmt:
result = transformDeclareCursorStmt(pstate,
(DeclareCursorStmt *) parseTree);
(DeclareCursorStmt *) parseTree);
break;
case T_ExplainStmt:
@@ -315,7 +315,7 @@ transformStmt(ParseState *pstate, Node *parseTree)
case T_CreateTableAsStmt:
result = transformCreateTableAsStmt(pstate,
(CreateTableAsStmt *) parseTree);
(CreateTableAsStmt *) parseTree);
break;
default:
@@ -490,7 +490,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
qry->override = stmt->override;
isOnConflictUpdate = (stmt->onConflictClause &&
stmt->onConflictClause->action == ONCONFLICT_UPDATE);
stmt->onConflictClause->action == ONCONFLICT_UPDATE);
/*
* We have three cases to deal with: DEFAULT VALUES (selectStmt == NULL),
@@ -839,7 +839,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
qry->targetList = lappend(qry->targetList, tle);
rte->insertedCols = bms_add_member(rte->insertedCols,
attr_num - FirstLowInvalidHeapAttributeNumber);
attr_num - FirstLowInvalidHeapAttributeNumber);
icols = lnext(icols);
attnos = lnext(attnos);
@@ -918,7 +918,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
errmsg("INSERT has more expressions than target columns"),
parser_errposition(pstate,
exprLocation(list_nth(exprlist,
list_length(icolumns))))));
list_length(icolumns))))));
if (stmtcols != NIL &&
list_length(exprlist) < list_length(icolumns))
{
@@ -940,7 +940,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
errhint("The insertion source is a row expression containing the same number of columns expected by the INSERT. Did you accidentally use extra parentheses?") : 0),
parser_errposition(pstate,
exprLocation(list_nth(icolumns,
list_length(exprlist))))));
list_length(exprlist))))));
}
/*
@@ -1199,7 +1199,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("SELECT ... INTO is not allowed here"),
parser_errposition(pstate,
exprLocation((Node *) stmt->intoClause))));
exprLocation((Node *) stmt->intoClause))));
/* make FOR UPDATE/FOR SHARE info available to addRangeTableEntry */
pstate->p_locking_clause = stmt->lockingClause;
@@ -1528,7 +1528,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to VALUES",
LCS_asString(((LockingClause *)
linitial(stmt->lockingClause))->strength))));
linitial(stmt->lockingClause))->strength))));
qry->rtable = pstate->p_rtable;
qry->jointree = makeFromExpr(pstate->p_joinlist, NULL);
@@ -1596,7 +1596,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("SELECT ... INTO is not allowed here"),
parser_errposition(pstate,
exprLocation((Node *) leftmostSelect->intoClause))));
exprLocation((Node *) leftmostSelect->intoClause))));
/*
* We need to extract ORDER BY and other top-level clauses here and not
@@ -1749,7 +1749,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
errdetail("Only result column names can be used, not expressions or functions."),
errhint("Add the expression/function to every SELECT, or move the UNION into a FROM clause."),
parser_errposition(pstate,
exprLocation(list_nth(qry->targetList, tllen)))));
exprLocation(list_nth(qry->targetList, tllen)))));
qry->limitOffset = transformLimitClause(pstate, limitOffset,
EXPR_KIND_OFFSET, "OFFSET");
@@ -1810,7 +1810,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"),
parser_errposition(pstate,
exprLocation((Node *) stmt->intoClause))));
exprLocation((Node *) stmt->intoClause))));
/* We don't support FOR UPDATE/SHARE with set ops at the moment. */
if (stmt->lockingClause)
@@ -1820,7 +1820,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s is not allowed with UNION/INTERSECT/EXCEPT",
LCS_asString(((LockingClause *)
linitial(stmt->lockingClause))->strength))));
linitial(stmt->lockingClause))->strength))));
/*
* If an internal node of a set-op tree has ORDER BY, LIMIT, FOR UPDATE,
@@ -1882,7 +1882,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"),
parser_errposition(pstate,
locate_var_of_level((Node *) selectQuery, 1))));
locate_var_of_level((Node *) selectQuery, 1))));
}
/*
@@ -1969,8 +1969,8 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
if (list_length(ltargetlist) != list_length(rtargetlist))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("each %s query must have the same number of columns",
context),
errmsg("each %s query must have the same number of columns",
context),
parser_errposition(pstate,
exprLocation((Node *) rtargetlist))));
@@ -2067,8 +2067,8 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
* collation.)
*/
rescolcoll = select_common_collation(pstate,
list_make2(lcolnode, rcolnode),
(op->op == SETOP_UNION && op->all));
list_make2(lcolnode, rcolnode),
(op->op == SETOP_UNION && op->all));
/* emit results */
op->colTypes = lappend_oid(op->colTypes, rescoltype);
@@ -2309,7 +2309,7 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist)
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("column \"%s\" of relation \"%s\" does not exist",
origTarget->name,
RelationGetRelationName(pstate->p_target_relation)),
RelationGetRelationName(pstate->p_target_relation)),
parser_errposition(pstate, origTarget->location)));
updateTargetListEntry(pstate, tle, origTarget->name,
@@ -2319,7 +2319,7 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist)
/* Mark the target column as requiring update permissions */
target_rte->updatedCols = bms_add_member(target_rte->updatedCols,
attrno - FirstLowInvalidHeapAttributeNumber);
attrno - FirstLowInvalidHeapAttributeNumber);
orig_tl = lnext(orig_tl);
}
@@ -2766,25 +2766,25 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc,
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to a join",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
parser_errposition(pstate, thisrel->location)));
break;
case RTE_FUNCTION:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
/*------
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to a function",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
errmsg("%s cannot be applied to a function",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
break;
case RTE_TABLEFUNC:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
/*------
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to a table function",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
errmsg("%s cannot be applied to a table function",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
break;
case RTE_VALUES:
ereport(ERROR,
@@ -2793,16 +2793,16 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc,
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to VALUES",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
parser_errposition(pstate, thisrel->location)));
break;
case RTE_CTE:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
/*------
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to a WITH query",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
errmsg("%s cannot be applied to a WITH query",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
break;
case RTE_NAMEDTUPLESTORE:
ereport(ERROR,
@@ -2811,7 +2811,7 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc,
translator: %s is a SQL row locking clause such as FOR UPDATE */
errmsg("%s cannot be applied to a named tuplestore",
LCS_asString(lc->strength)),
parser_errposition(pstate, thisrel->location)));
parser_errposition(pstate, thisrel->location)));
break;
default:
elog(ERROR, "unrecognized RTE type: %d",

View File

@@ -640,15 +640,15 @@ check_agg_arguments(ParseState *pstate,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("outer-level aggregate cannot contain a lower-level variable in its direct arguments"),
parser_errposition(pstate,
locate_var_of_level((Node *) directargs,
context.min_varlevel))));
locate_var_of_level((Node *) directargs,
context.min_varlevel))));
if (context.min_agglevel >= 0 && context.min_agglevel <= agglevel)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregate function calls cannot be nested"),
parser_errposition(pstate,
locate_agg_of_level((Node *) directargs,
context.min_agglevel))));
locate_agg_of_level((Node *) directargs,
context.min_agglevel))));
}
return agglevel;
}
@@ -771,7 +771,7 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("window function calls cannot be nested"),
parser_errposition(pstate,
locate_windowfunc((Node *) wfunc->args))));
locate_windowfunc((Node *) wfunc->args))));
/*
* Check to see if the window function is in an invalid place within the
@@ -1016,8 +1016,8 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
errmsg("too many grouping sets present (maximum 4096)"),
parser_errposition(pstate,
qry->groupClause
? exprLocation((Node *) qry->groupClause)
: exprLocation((Node *) qry->groupingSets))));
? exprLocation((Node *) qry->groupClause)
: exprLocation((Node *) qry->groupingSets))));
/*
* The intersection will often be empty, so help things along by
@@ -1095,7 +1095,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
root->hasJoinRTEs = true;
groupClauses = (List *) flatten_join_alias_vars(root,
(Node *) groupClauses);
(Node *) groupClauses);
}
/*

View File

@@ -359,7 +359,7 @@ transformJoinUsingClause(ParseState *pstate,
/* Now create the lvar = rvar join condition */
e = makeSimpleA_Expr(AEXPR_OP, "=",
(Node *) copyObject(lvar), (Node *) copyObject(rvar),
(Node *) copyObject(lvar), (Node *) copyObject(rvar),
-1);
/* Prepare to combine into an AND clause, if multiple join columns */
@@ -636,7 +636,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("set-returning functions must appear at top level of FROM"),
parser_errposition(pstate,
exprLocation(pstate->p_last_srf))));
exprLocation(pstate->p_last_srf))));
funcexprs = lappend(funcexprs, newfexpr);
@@ -676,7 +676,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple column definition lists are not allowed for the same function"),
parser_errposition(pstate,
exprLocation((Node *) r->coldeflist))));
exprLocation((Node *) r->coldeflist))));
coldeflists = lappend(coldeflists, coldeflist);
}
@@ -710,22 +710,22 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
errmsg("ROWS FROM() with multiple functions cannot have a column definition list"),
errhint("Put a separate column definition list for each function inside ROWS FROM()."),
parser_errposition(pstate,
exprLocation((Node *) r->coldeflist))));
exprLocation((Node *) r->coldeflist))));
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("UNNEST() with multiple arguments cannot have a column definition list"),
errhint("Use separate UNNEST() calls inside ROWS FROM(), and attach a column definition list to each one."),
parser_errposition(pstate,
exprLocation((Node *) r->coldeflist))));
exprLocation((Node *) r->coldeflist))));
}
if (r->ordinality)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("WITH ORDINALITY cannot be used with a column definition list"),
errhint("Put the column definition list inside ROWS FROM()."),
errhint("Put the column definition list inside ROWS FROM()."),
parser_errposition(pstate,
exprLocation((Node *) r->coldeflist))));
exprLocation((Node *) r->coldeflist))));
coldeflists = list_make1(r->coldeflist);
}
@@ -785,7 +785,7 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf)
/* Transform and apply typecast to the row-generating expression ... */
Assert(rtf->rowexpr != NULL);
tf->rowexpr = coerce_to_specific_type(pstate,
transformExpr(pstate, rtf->rowexpr, EXPR_KIND_FROM_FUNCTION),
transformExpr(pstate, rtf->rowexpr, EXPR_KIND_FROM_FUNCTION),
TEXTOID,
constructName);
assign_expr_collations(pstate, tf->rowexpr);
@@ -793,7 +793,7 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf)
/* ... and to the document itself */
Assert(rtf->docexpr != NULL);
tf->docexpr = coerce_to_specific_type(pstate,
transformExpr(pstate, rtf->docexpr, EXPR_KIND_FROM_FUNCTION),
transformExpr(pstate, rtf->docexpr, EXPR_KIND_FROM_FUNCTION),
docType,
constructName);
assign_expr_collations(pstate, tf->docexpr);
@@ -849,14 +849,14 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf)
tf->coltypes = lappend_oid(tf->coltypes, typid);
tf->coltypmods = lappend_int(tf->coltypmods, typmod);
tf->colcollations = lappend_oid(tf->colcollations,
type_is_collatable(typid) ? DEFAULT_COLLATION_OID : InvalidOid);
type_is_collatable(typid) ? DEFAULT_COLLATION_OID : InvalidOid);
/* Transform the PATH and DEFAULT expressions */
if (rawc->colexpr)
{
colexpr = coerce_to_specific_type(pstate,
transformExpr(pstate, rawc->colexpr,
EXPR_KIND_FROM_FUNCTION),
transformExpr(pstate, rawc->colexpr,
EXPR_KIND_FROM_FUNCTION),
TEXTOID,
constructName);
assign_expr_collations(pstate, colexpr);
@@ -867,8 +867,8 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf)
if (rawc->coldefexpr)
{
coldefexpr = coerce_to_specific_type_typmod(pstate,
transformExpr(pstate, rawc->coldefexpr,
EXPR_KIND_FROM_FUNCTION),
transformExpr(pstate, rawc->coldefexpr,
EXPR_KIND_FROM_FUNCTION),
typid, typmod,
constructName);
assign_expr_collations(pstate, coldefexpr);
@@ -1022,12 +1022,12 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts)
if (list_length(rts->args) != list_length(tsm->parameterTypes))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT),
errmsg_plural("tablesample method %s requires %d argument, not %d",
"tablesample method %s requires %d arguments, not %d",
list_length(tsm->parameterTypes),
NameListToString(rts->method),
list_length(tsm->parameterTypes),
list_length(rts->args)),
errmsg_plural("tablesample method %s requires %d argument, not %d",
"tablesample method %s requires %d arguments, not %d",
list_length(tsm->parameterTypes),
NameListToString(rts->method),
list_length(tsm->parameterTypes),
list_length(rts->args)),
parser_errposition(pstate, rts->location)));
/*
@@ -1056,8 +1056,8 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts)
if (!tsm->repeatable_across_queries)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("tablesample method %s does not support REPEATABLE",
NameListToString(rts->method)),
errmsg("tablesample method %s does not support REPEATABLE",
NameListToString(rts->method)),
parser_errposition(pstate, rts->location)));
arg = transformExpr(pstate, rts->repeatable, EXPR_KIND_FROM_FUNCTION);
@@ -1218,7 +1218,7 @@ transformFromClauseItem(ParseState *pstate, Node *n,
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("TABLESAMPLE clause can only be applied to tables and materialized views"),
parser_errposition(pstate, exprLocation(rts->relation))));
parser_errposition(pstate, exprLocation(rts->relation))));
/* Transform TABLESAMPLE details and attach to the RTE */
rte->tablesample = transformRangeTableSample(pstate, rts);
@@ -1830,7 +1830,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle,
errmsg("aggregate functions are not allowed in %s",
ParseExprKindName(exprKind)),
parser_errposition(pstate,
locate_agg_of_level((Node *) tle->expr, 0))));
locate_agg_of_level((Node *) tle->expr, 0))));
if (pstate->p_hasWindowFuncs &&
contain_windowfuncs((Node *) tle->expr))
ereport(ERROR,
@@ -1839,7 +1839,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle,
errmsg("window functions are not allowed in %s",
ParseExprKindName(exprKind)),
parser_errposition(pstate,
locate_windowfunc((Node *) tle->expr))));
locate_windowfunc((Node *) tle->expr))));
break;
case EXPR_KIND_ORDER_BY:
/* no extra checks needed */
@@ -2415,7 +2415,7 @@ transformGroupingSet(List **flatresult,
List *l = transformGroupClauseList(flatresult,
pstate, (List *) n,
targetlist, sortClause,
exprKind, useSQL99, false);
exprKind, useSQL99, false);
content = lappend(content, makeGroupingSet(GROUPING_SET_SIMPLE,
l,
@@ -2427,8 +2427,8 @@ transformGroupingSet(List **flatresult,
content = lappend(content, transformGroupingSet(flatresult,
pstate, gset2,
targetlist, sortClause,
exprKind, useSQL99, false));
targetlist, sortClause,
exprKind, useSQL99, false));
}
else
{
@@ -2530,7 +2530,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets,
{
flat_grouplist = list_make1(makeGroupingSet(GROUPING_SET_EMPTY,
NIL,
exprLocation((Node *) grouplist)));
exprLocation((Node *) grouplist)));
}
foreach(gl, flat_grouplist)
@@ -2556,8 +2556,8 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets,
gsets = lappend(gsets,
transformGroupingSet(&result,
pstate, gset,
targetlist, sortClause,
exprKind, useSQL99, true));
targetlist, sortClause,
exprKind, useSQL99, true));
break;
}
}
@@ -2566,7 +2566,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets,
Index ref = transformGroupClauseExpr(&result, seen_local,
pstate, gexpr,
targetlist, sortClause,
exprKind, useSQL99, true);
exprKind, useSQL99, true);
if (ref > 0)
{
@@ -2719,8 +2719,8 @@ transformWindowDefinitions(ParseState *pstate,
if (partitionClause)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot override PARTITION BY clause of window \"%s\"",
windef->refname),
errmsg("cannot override PARTITION BY clause of window \"%s\"",
windef->refname),
parser_errposition(pstate, windef->location)));
wc->partitionClause = copyObject(refwc->partitionClause);
}
@@ -2731,8 +2731,8 @@ transformWindowDefinitions(ParseState *pstate,
if (orderClause && refwc->orderClause)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot override ORDER BY clause of window \"%s\"",
windef->refname),
errmsg("cannot override ORDER BY clause of window \"%s\"",
windef->refname),
parser_errposition(pstate, windef->location)));
if (orderClause)
{
@@ -2767,8 +2767,8 @@ transformWindowDefinitions(ParseState *pstate,
/* Else this clause is just OVER (foo), so say this: */
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot copy window \"%s\" because it has a frame clause",
windef->refname),
errmsg("cannot copy window \"%s\" because it has a frame clause",
windef->refname),
errhint("Omit the parentheses in this OVER clause."),
parser_errposition(pstate, windef->location)));
}
@@ -2868,7 +2868,7 @@ transformDistinctClause(ParseState *pstate,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
is_agg ?
errmsg("an aggregate with DISTINCT must have at least one argument") :
errmsg("an aggregate with DISTINCT must have at least one argument") :
errmsg("SELECT DISTINCT must have at least one column")));
return result;
@@ -2937,9 +2937,9 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("SELECT DISTINCT ON expressions must match initial ORDER BY expressions"),
parser_errposition(pstate,
get_matching_location(scl->tleSortGroupRef,
sortgrouprefs,
distinctlist))));
get_matching_location(scl->tleSortGroupRef,
sortgrouprefs,
distinctlist))));
else
result = lappend(result, copyObject(scl));
}
@@ -3051,7 +3051,7 @@ resolve_unique_index_expr(ParseState *pstate, InferClause *infer,
if (ielem->nulls_ordering != SORTBY_NULLS_DEFAULT)
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("NULLS FIRST/LAST is not allowed in ON CONFLICT clause"),
errmsg("NULLS FIRST/LAST is not allowed in ON CONFLICT clause"),
parser_errposition(pstate,
exprLocation((Node *) infer))));
@@ -3134,7 +3134,7 @@ transformOnConflictArbiter(ParseState *pstate,
errmsg("ON CONFLICT DO UPDATE requires inference specification or constraint name"),
errhint("For example, ON CONFLICT (column_name)."),
parser_errposition(pstate,
exprLocation((Node *) onConflictClause))));
exprLocation((Node *) onConflictClause))));
/*
* To simplify certain aspects of its design, speculative insertion into
@@ -3143,9 +3143,9 @@ transformOnConflictArbiter(ParseState *pstate,
if (IsCatalogRelation(pstate->p_target_relation))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ON CONFLICT is not supported with system catalog tables"),
errmsg("ON CONFLICT is not supported with system catalog tables"),
parser_errposition(pstate,
exprLocation((Node *) onConflictClause))));
exprLocation((Node *) onConflictClause))));
/* Same applies to table used by logical decoding as catalog table */
if (RelationIsUsedAsCatalogTable(pstate->p_target_relation))
@@ -3154,7 +3154,7 @@ transformOnConflictArbiter(ParseState *pstate,
errmsg("ON CONFLICT is not supported on table \"%s\" used as a catalog table",
RelationGetRelationName(pstate->p_target_relation)),
parser_errposition(pstate,
exprLocation((Node *) onConflictClause))));
exprLocation((Node *) onConflictClause))));
/* ON CONFLICT DO NOTHING does not require an inference clause */
if (infer)
@@ -3172,7 +3172,7 @@ transformOnConflictArbiter(ParseState *pstate,
if (infer->indexElems)
*arbiterExpr = resolve_unique_index_expr(pstate, infer,
pstate->p_target_relation);
pstate->p_target_relation);
/*
* Handling inference WHERE clause (for partial unique index
@@ -3277,8 +3277,8 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
if (!OidIsValid(eqop))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("operator %s is not a valid ordering operator",
strVal(llast(sortby->useOp))),
errmsg("operator %s is not a valid ordering operator",
strVal(llast(sortby->useOp))),
errhint("Ordering operators must be \"<\" or \">\" members of btree operator families.")));
/*

View File

@@ -302,7 +302,7 @@ coerce_type(ParseState *pstate, Node *node,
*/
if (!con->constisnull)
newcon->constvalue = stringTypeDatum(baseType,
DatumGetCString(con->constvalue),
DatumGetCString(con->constvalue),
inputTypeMod);
else
newcon->constvalue = stringTypeDatum(baseType,
@@ -342,7 +342,7 @@ coerce_type(ParseState *pstate, Node *node,
val2 = PointerGetDatum(PG_DETOAST_DATUM(val2));
if (!datumIsEqual(newcon->constvalue, val2, false, newcon->constlen))
elog(WARNING, "type %s has unstable input conversion for \"%s\"",
typeTypeName(baseType), DatumGetCString(con->constvalue));
typeTypeName(baseType), DatumGetCString(con->constvalue));
}
#endif
@@ -418,7 +418,7 @@ coerce_type(ParseState *pstate, Node *node,
result = build_coercion_expression(node, pathtype, funcId,
baseTypeId, baseTypeMod,
cformat, location,
(cformat != COERCE_IMPLICIT_CAST));
(cformat != COERCE_IMPLICIT_CAST));
/*
* If domain, coerce to the domain type and relabel with domain
@@ -1646,7 +1646,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (OidIsValid(elem_typeid) && actual_type != elem_typeid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("arguments declared \"anyelement\" are not all alike"),
errmsg("arguments declared \"anyelement\" are not all alike"),
errdetail("%s versus %s",
format_type_be(elem_typeid),
format_type_be(actual_type))));
@@ -1666,7 +1666,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (OidIsValid(array_typeid) && actual_type != array_typeid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("arguments declared \"anyarray\" are not all alike"),
errmsg("arguments declared \"anyarray\" are not all alike"),
errdetail("%s versus %s",
format_type_be(array_typeid),
format_type_be(actual_type))));
@@ -1686,7 +1686,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (OidIsValid(range_typeid) && actual_type != range_typeid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("arguments declared \"anyrange\" are not all alike"),
errmsg("arguments declared \"anyrange\" are not all alike"),
errdetail("%s versus %s",
format_type_be(range_typeid),
format_type_be(actual_type))));
@@ -1715,8 +1715,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(array_typeid))));
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(array_typeid))));
}
if (!OidIsValid(elem_typeid))
@@ -1753,9 +1753,9 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(range_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not a range type but type %s",
"anyrange",
format_type_be(range_typeid))));
errmsg("argument declared %s is not a range type but type %s",
"anyrange",
format_type_be(range_typeid))));
}
if (!OidIsValid(elem_typeid))
@@ -1802,8 +1802,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (type_is_array_domain(elem_typeid))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("type matched to anynonarray is an array type: %s",
format_type_be(elem_typeid))));
errmsg("type matched to anynonarray is an array type: %s",
format_type_be(elem_typeid))));
}
if (have_anyenum && elem_typeid != ANYELEMENTOID)
@@ -1841,8 +1841,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(array_typeid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s",
format_type_be(elem_typeid))));
errmsg("could not find array type for data type %s",
format_type_be(elem_typeid))));
}
declared_arg_types[j] = array_typeid;
}
@@ -1852,8 +1852,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find range type for data type %s",
format_type_be(elem_typeid))));
errmsg("could not find range type for data type %s",
format_type_be(elem_typeid))));
}
declared_arg_types[j] = range_typeid;
}
@@ -1930,8 +1930,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
return context_base_type;
}
else if (context_declared_type == ANYELEMENTOID ||
@@ -1964,8 +1964,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
return array_typelem;
}
else if (context_declared_type == ANYRANGEOID)
@@ -1977,8 +1977,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(range_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not a range type but type %s",
"anyrange", format_type_be(context_base_type))));
errmsg("argument declared %s is not a range type but type %s",
"anyrange", format_type_be(context_base_type))));
return range_typelem;
}
else if (context_declared_type == ANYELEMENTOID ||
@@ -2253,7 +2253,7 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
Oid sourceElem;
if ((targetElem = get_element_type(targetTypeId)) != InvalidOid &&
(sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid)
(sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid)
{
CoercionPathType elempathtype;
Oid elemfuncid;

View File

@@ -604,11 +604,11 @@ assign_collations_walker(Node *node, assign_collations_context *context)
break;
case AGGKIND_ORDERED_SET:
assign_ordered_set_collations(aggref,
&loccontext);
&loccontext);
break;
case AGGKIND_HYPOTHETICAL:
assign_hypothetical_collations(aggref,
&loccontext);
&loccontext);
break;
default:
elog(ERROR, "unrecognized aggkind: %d",
@@ -616,7 +616,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
}
assign_expr_collations(context->pstate,
(Node *) aggref->aggfilter);
(Node *) aggref->aggfilter);
}
break;
case T_WindowFunc:
@@ -674,7 +674,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
* equally to loccontext.
*/
(void) expression_tree_walker(node,
assign_collations_walker,
assign_collations_walker,
(void *) &loccontext);
break;
}
@@ -900,7 +900,7 @@ assign_ordered_set_collations(Aggref *aggref,
/* Merge sort collations to parent only if there can be only one */
merge_sort_collations = (list_length(aggref->args) == 1 &&
get_func_variadictype(aggref->aggfnoid) == InvalidOid);
get_func_variadictype(aggref->aggfnoid) == InvalidOid);
/* Direct args, if any, are normal children of the Aggref node */
(void) assign_collations_walker((Node *) aggref->aggdirectargs,
@@ -938,7 +938,7 @@ assign_hypothetical_collations(Aggref *aggref,
/* Merge sort collations to parent only if there can be only one */
merge_sort_collations = (list_length(aggref->args) == 1 &&
get_func_variadictype(aggref->aggfnoid) == InvalidOid);
get_func_variadictype(aggref->aggfnoid) == InvalidOid);
/* Process any non-hypothetical direct args */
extra_args = list_length(aggref->aggdirectargs) - list_length(aggref->args);

View File

@@ -129,8 +129,8 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
if (strcmp(cte->ctename, cte2->ctename) == 0)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_ALIAS),
errmsg("WITH query name \"%s\" specified more than once",
cte2->ctename),
errmsg("WITH query name \"%s\" specified more than once",
cte2->ctename),
parser_errposition(pstate, cte2->location)));
}
@@ -313,7 +313,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
errmsg("recursive query \"%s\" column %d has type %s in non-recursive term but type %s overall",
cte->ctename, varattno,
format_type_with_typemod(lfirst_oid(lctyp),
lfirst_int(lctypmod)),
lfirst_int(lctypmod)),
format_type_with_typemod(exprType(texpr),
exprTypmod(texpr))),
errhint("Cast the output of the non-recursive term to the correct type."),
@@ -595,7 +595,7 @@ TopologicalSort(ParseState *pstate, CteItem *items, int numitems)
if (j >= numitems)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("mutual recursion between WITH items is not implemented"),
errmsg("mutual recursion between WITH items is not implemented"),
parser_errposition(pstate, items[i].cte->location)));
/*
@@ -699,9 +699,9 @@ checkWellFormedRecursion(CteState *cstate)
if (stmt->sortClause)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ORDER BY in a recursive query is not implemented"),
errmsg("ORDER BY in a recursive query is not implemented"),
parser_errposition(cstate->pstate,
exprLocation((Node *) stmt->sortClause))));
exprLocation((Node *) stmt->sortClause))));
if (stmt->limitOffset)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -719,7 +719,7 @@ checkWellFormedRecursion(CteState *cstate)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("FOR UPDATE/SHARE in a recursive query is not implemented"),
parser_errposition(cstate->pstate,
exprLocation((Node *) stmt->lockingClause))));
exprLocation((Node *) stmt->lockingClause))));
}
}

View File

@@ -418,8 +418,8 @@ unknown_attribute(ParseState *pstate, Node *relref, char *attname,
else if (relTypeId == RECORDOID)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("could not identify column \"%s\" in record data type",
attname),
errmsg("could not identify column \"%s\" in record data type",
attname),
parser_errposition(pstate, location)));
else
ereport(ERROR,
@@ -786,15 +786,15 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
case CRERR_WRONG_DB:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cross-database references are not implemented: %s",
NameListToString(cref->fields)),
errmsg("cross-database references are not implemented: %s",
NameListToString(cref->fields)),
parser_errposition(pstate, cref->location)));
break;
case CRERR_TOO_MANY:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper qualified name (too many dotted names): %s",
NameListToString(cref->fields)),
errmsg("improper qualified name (too many dotted names): %s",
NameListToString(cref->fields)),
parser_errposition(pstate, cref->location)));
break;
}
@@ -1263,7 +1263,7 @@ transformAExprIn(ParseState *pstate, A_Expr *a)
/* ROW() op ROW() is handled specially */
cmp = make_row_comparison_op(pstate,
a->name,
copyObject(((RowExpr *) lexpr)->args),
copyObject(((RowExpr *) lexpr)->args),
((RowExpr *) rexpr)->args,
a->location);
}
@@ -1364,10 +1364,10 @@ transformAExprBetween(ParseState *pstate, A_Expr *a)
a->location));
sub1 = (Node *) makeBoolExpr(AND_EXPR, args, a->location);
args = list_make2(makeSimpleA_Expr(AEXPR_OP, ">=",
copyObject(aexpr), copyObject(cexpr),
copyObject(aexpr), copyObject(cexpr),
a->location),
makeSimpleA_Expr(AEXPR_OP, "<=",
copyObject(aexpr), copyObject(bexpr),
copyObject(aexpr), copyObject(bexpr),
a->location));
sub2 = (Node *) makeBoolExpr(AND_EXPR, args, a->location);
args = list_make2(sub1, sub2);
@@ -1382,10 +1382,10 @@ transformAExprBetween(ParseState *pstate, A_Expr *a)
a->location));
sub1 = (Node *) makeBoolExpr(OR_EXPR, args, a->location);
args = list_make2(makeSimpleA_Expr(AEXPR_OP, "<",
copyObject(aexpr), copyObject(cexpr),
copyObject(aexpr), copyObject(cexpr),
a->location),
makeSimpleA_Expr(AEXPR_OP, ">",
copyObject(aexpr), copyObject(bexpr),
copyObject(aexpr), copyObject(bexpr),
a->location));
sub2 = (Node *) makeBoolExpr(OR_EXPR, args, a->location);
args = list_make2(sub1, sub2);
@@ -1516,7 +1516,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref)
if (count_nonjunk_tlist_entries(qtree->targetList) != maref->ncolumns)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("number of columns does not match number of values"),
errmsg("number of columns does not match number of values"),
parser_errposition(pstate, sublink->location)));
/*
@@ -1548,7 +1548,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref)
if (list_length(rexpr->args) != maref->ncolumns)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("number of columns does not match number of values"),
errmsg("number of columns does not match number of values"),
parser_errposition(pstate, rexpr->location)));
/*
@@ -1563,7 +1563,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"),
parser_errposition(pstate, exprLocation(maref->source))));
parser_errposition(pstate, exprLocation(maref->source))));
}
else
{
@@ -2096,8 +2096,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
if (!OidIsValid(element_type))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find element type for data type %s",
format_type_be(array_type)),
errmsg("could not find element type for data type %s",
format_type_be(array_type)),
parser_errposition(pstate, a->location)));
}
else
@@ -2383,8 +2383,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
x->op == IS_XMLELEMENT
? errmsg("unnamed XML attribute value must be a column reference")
: errmsg("unnamed XML element value must be a column reference"),
? errmsg("unnamed XML attribute value must be a column reference")
: errmsg("unnamed XML element value must be a column reference"),
parser_errposition(pstate, r->location)));
argname = NULL; /* keep compiler quiet */
}
@@ -2399,8 +2399,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
if (strcmp(argname, strVal(lfirst(lc2))) == 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("XML attribute name \"%s\" appears more than once",
argname),
errmsg("XML attribute name \"%s\" appears more than once",
argname),
parser_errposition(pstate, r->location)));
}
}
@@ -2480,7 +2480,7 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
xexpr = makeNode(XmlExpr);
xexpr->op = IS_XMLSERIALIZE;
xexpr->args = list_make1(coerce_to_specific_type(pstate,
transformExprRecurse(pstate, xs->expr),
transformExprRecurse(pstate, xs->expr),
XMLOID,
"XMLSERIALIZE"));
@@ -2837,9 +2837,9 @@ make_row_comparison_op(ParseState *pstate, List *opname,
if (cmp->opresulttype != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("row comparison operator must yield type boolean, "
"not type %s",
format_type_be(cmp->opresulttype)),
errmsg("row comparison operator must yield type boolean, "
"not type %s",
format_type_be(cmp->opresulttype)),
parser_errposition(pstate, location)));
if (expression_returns_set((Node *) cmp))
ereport(ERROR,
@@ -2946,7 +2946,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine interpretation of row comparison operator %s",
strVal(llast(opname))),
errdetail("There are multiple equally-plausible candidates."),
errdetail("There are multiple equally-plausible candidates."),
parser_errposition(pstate, location)));
}
@@ -3039,7 +3039,7 @@ make_distinct_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree,
if (((OpExpr *) result)->opresulttype != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("IS DISTINCT FROM requires = operator to yield boolean"),
errmsg("IS DISTINCT FROM requires = operator to yield boolean"),
parser_errposition(pstate, location)));
if (((OpExpr *) result)->opretset)
ereport(ERROR,

View File

@@ -117,10 +117,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (list_length(fargs) > FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
errmsg_plural("cannot pass more than %d argument to a function",
"cannot pass more than %d arguments to a function",
FUNC_MAX_ARGS,
FUNC_MAX_ARGS),
errmsg_plural("cannot pass more than %d argument to a function",
"cannot pass more than %d arguments to a function",
FUNC_MAX_ARGS,
FUNC_MAX_ARGS),
parser_errposition(pstate, location)));
/*
@@ -176,8 +176,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (strcmp(na->name, (char *) lfirst(lc)) == 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("argument name \"%s\" used more than once",
na->name),
errmsg("argument name \"%s\" used more than once",
na->name),
parser_errposition(pstate, na->location)));
}
argnames = lappend(argnames, na->name);
@@ -187,7 +187,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (argnames != NIL)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("positional argument cannot follow named argument"),
errmsg("positional argument cannot follow named argument"),
parser_errposition(pstate, exprLocation(arg))));
}
}
@@ -272,15 +272,15 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (agg_star)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("%s(*) specified, but %s is not an aggregate function",
NameListToString(funcname),
NameListToString(funcname)),
errmsg("%s(*) specified, but %s is not an aggregate function",
NameListToString(funcname),
NameListToString(funcname)),
parser_errposition(pstate, location)));
if (agg_distinct)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("DISTINCT specified, but %s is not an aggregate function",
NameListToString(funcname)),
errmsg("DISTINCT specified, but %s is not an aggregate function",
NameListToString(funcname)),
parser_errposition(pstate, location)));
if (agg_within_group)
ereport(ERROR,
@@ -291,14 +291,14 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (agg_order != NIL)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("ORDER BY specified, but %s is not an aggregate function",
NameListToString(funcname)),
errmsg("ORDER BY specified, but %s is not an aggregate function",
NameListToString(funcname)),
parser_errposition(pstate, location)));
if (agg_filter)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("FILTER specified, but %s is not an aggregate function",
NameListToString(funcname)),
errmsg("FILTER specified, but %s is not an aggregate function",
NameListToString(funcname)),
parser_errposition(pstate, location)));
if (over)
ereport(ERROR,
@@ -339,8 +339,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (over)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("OVER is not supported for ordered-set aggregate %s",
NameListToString(funcname)),
errmsg("OVER is not supported for ordered-set aggregate %s",
NameListToString(funcname)),
parser_errposition(pstate, location)));
/* gram.y rejects DISTINCT + WITHIN GROUP */
Assert(!agg_distinct);
@@ -398,7 +398,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
errmsg("function %s does not exist",
func_signature_string(funcname, nargs,
argnames,
actual_arg_types)),
actual_arg_types)),
errhint("There is an ordered-set aggregate %s, but it requires %d direct arguments, not %d.",
NameListToString(funcname),
catDirectArgs, numDirectArgs),
@@ -421,12 +421,12 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("function %s does not exist",
func_signature_string(funcname, nargs,
argnames,
actual_arg_types)),
func_signature_string(funcname, nargs,
argnames,
actual_arg_types)),
errhint("To use the hypothetical-set aggregate %s, the number of hypothetical direct arguments (here %d) must match the number of ordering columns (here %d).",
NameListToString(funcname),
nvargs - numAggregatedArgs, numAggregatedArgs),
nvargs - numAggregatedArgs, numAggregatedArgs),
parser_errposition(pstate, location)));
}
else
@@ -435,9 +435,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("function %s does not exist",
func_signature_string(funcname, nargs,
argnames,
actual_arg_types)),
func_signature_string(funcname, nargs,
argnames,
actual_arg_types)),
errhint("There is an ordered-set aggregate %s, but it requires at least %d direct arguments.",
NameListToString(funcname),
catDirectArgs),
@@ -513,7 +513,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
func_signature_string(funcname, nargs, argnames,
actual_arg_types)),
errhint("No aggregate function matches the given name and argument types. "
"Perhaps you misplaced ORDER BY; ORDER BY must appear "
"Perhaps you misplaced ORDER BY; ORDER BY must appear "
"after all regular arguments of the aggregate."),
parser_errposition(pstate, location)));
}
@@ -523,8 +523,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
errmsg("function %s does not exist",
func_signature_string(funcname, nargs, argnames,
actual_arg_types)),
errhint("No function matches the given name and argument types. "
"You might need to add explicit type casts."),
errhint("No function matches the given name and argument types. "
"You might need to add explicit type casts."),
parser_errposition(pstate, location)));
}
@@ -544,10 +544,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (nargsplusdefs >= FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
errmsg_plural("cannot pass more than %d argument to a function",
"cannot pass more than %d arguments to a function",
FUNC_MAX_ARGS,
FUNC_MAX_ARGS),
errmsg_plural("cannot pass more than %d argument to a function",
"cannot pass more than %d arguments to a function",
FUNC_MAX_ARGS,
FUNC_MAX_ARGS),
parser_errposition(pstate, location)));
actual_arg_types[nargsplusdefs++] = exprType(expr);
@@ -601,7 +601,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s",
format_type_be(newa->element_typeid)),
parser_errposition(pstate, exprLocation((Node *) vargs))));
parser_errposition(pstate, exprLocation((Node *) vargs))));
/* array_collid will be set by parse_collate.c */
newa->multidims = false;
newa->location = exprLocation((Node *) vargs);
@@ -627,7 +627,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("VARIADIC argument must be an array"),
parser_errposition(pstate,
exprLocation((Node *) llast(fargs)))));
exprLocation((Node *) llast(fargs)))));
}
/* if it returns a set, check that's OK */
@@ -731,7 +731,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (agg_distinct)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("DISTINCT is not implemented for window functions"),
errmsg("DISTINCT is not implemented for window functions"),
parser_errposition(pstate, location)));
/*
@@ -918,10 +918,10 @@ func_select_candidate(int nargs,
if (nargs > FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
errmsg_plural("cannot pass more than %d argument to a function",
"cannot pass more than %d arguments to a function",
FUNC_MAX_ARGS,
FUNC_MAX_ARGS)));
errmsg_plural("cannot pass more than %d argument to a function",
"cannot pass more than %d arguments to a function",
FUNC_MAX_ARGS,
FUNC_MAX_ARGS)));
/*
* If any input types are domains, reduce them to their base types. This
@@ -1400,7 +1400,7 @@ func_get_detail(List *funcname,
case COERCION_PATH_COERCEVIAIO:
if ((sourceType == RECORDOID ||
ISCOMPLEX(sourceType)) &&
TypeCategory(targetType) == TYPCATEGORY_STRING)
TypeCategory(targetType) == TYPCATEGORY_STRING)
iscoercion = false;
else
iscoercion = true;
@@ -2152,7 +2152,7 @@ check_srf_call_placement(ParseState *pstate, Node *last_srf, int location)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("set-returning functions must appear at top level of FROM"),
parser_errposition(pstate,
exprLocation(pstate->p_last_srf))));
exprLocation(pstate->p_last_srf))));
break;
case EXPR_KIND_WHERE:
errkind = true;

View File

@@ -356,7 +356,7 @@ transformArraySubscripts(ParseState *pstate,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("array subscript must have type integer"),
parser_errposition(pstate, exprLocation(ai->lidx))));
parser_errposition(pstate, exprLocation(ai->lidx))));
}
else if (!ai->is_slice)
{
@@ -427,7 +427,7 @@ transformArraySubscripts(ParseState *pstate,
" but expression is of type %s",
format_type_be(typeneeded),
format_type_be(typesource)),
errhint("You will need to rewrite or cast the expression."),
errhint("You will need to rewrite or cast the expression."),
parser_errposition(pstate, exprLocation(assignFrom))));
assignFrom = newFrom;
}

View File

@@ -221,7 +221,7 @@ get_sort_group_operators(Oid argtype,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("could not identify an ordering operator for type %s",
format_type_be(argtype)),
errhint("Use an explicit ordering operator or modify the query.")));
errhint("Use an explicit ordering operator or modify the query.")));
if (needEQ && !OidIsValid(eq_opr))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
@@ -723,8 +723,8 @@ op_error(ParseState *pstate, List *op, char oprkind,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("operator does not exist: %s",
op_signature_string(op, oprkind, arg1, arg2)),
errhint("No operator matches the given name and argument type(s). "
"You might need to add explicit type casts."),
errhint("No operator matches the given name and argument type(s). "
"You might need to add explicit type casts."),
parser_errposition(pstate, location)));
}
@@ -894,7 +894,7 @@ make_scalar_array_op(ParseState *pstate, List *opname,
if (!OidIsValid(rtypeId))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("op ANY/ALL (array) requires array on right side"),
errmsg("op ANY/ALL (array) requires array on right side"),
parser_errposition(pstate, location)));
}
@@ -936,12 +936,12 @@ make_scalar_array_op(ParseState *pstate, List *opname,
if (rettype != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("op ANY/ALL (array) requires operator to yield boolean"),
errmsg("op ANY/ALL (array) requires operator to yield boolean"),
parser_errposition(pstate, location)));
if (get_func_retset(opform->oprcode))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("op ANY/ALL (array) requires operator not to return a set"),
errmsg("op ANY/ALL (array) requires operator not to return a set"),
parser_errposition(pstate, location)));
/*
@@ -1057,7 +1057,7 @@ make_oper_cache_key(ParseState *pstate, OprCacheKey *key, List *opname,
{
/* get the active search path */
if (fetch_search_path_array(key->search_path,
MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN)
MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN)
return false; /* oops, didn't fit */
}

View File

@@ -301,8 +301,8 @@ check_parameter_resolution_walker(Node *node, ParseState *pstate)
if (param->paramtype != (*parstate->paramTypes)[paramno - 1])
ereport(ERROR,
(errcode(ERRCODE_AMBIGUOUS_PARAMETER),
errmsg("could not determine data type of parameter $%d",
paramno),
errmsg("could not determine data type of parameter $%d",
paramno),
parser_errposition(pstate, param->location)));
}
return false;

View File

@@ -443,8 +443,8 @@ check_lateral_ref_ok(ParseState *pstate, ParseNamespaceItem *nsitem,
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
refname),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
refname),
(rte == pstate->p_target_rangetblentry) ?
errhint("There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
refname) :
@@ -868,7 +868,7 @@ searchRangeTableForCol(ParseState *pstate, const char *alias, char *colname,
fuzzy_rte_penalty =
varstr_levenshtein_less_equal(alias, strlen(alias),
rte->eref->aliasname,
strlen(rte->eref->aliasname),
strlen(rte->eref->aliasname),
1, 1, 1,
MAX_FUZZY_DISTANCE + 1,
true);
@@ -918,7 +918,7 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
rte->requiredPerms |= ACL_SELECT;
/* Must offset the attnum to fit in a bitmapset */
rte->selectedCols = bms_add_member(rte->selectedCols,
col - FirstLowInvalidHeapAttributeNumber);
col - FirstLowInvalidHeapAttributeNumber);
}
else if (rte->rtekind == RTE_JOIN)
{
@@ -1491,7 +1491,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("a column definition list is only allowed for functions returning \"record\""),
parser_errposition(pstate,
exprLocation((Node *) coldeflist))));
exprLocation((Node *) coldeflist))));
}
else
{
@@ -1577,8 +1577,8 @@ addRangeTableEntryForFunction(ParseState *pstate,
else
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("function \"%s\" in FROM has unsupported return type %s",
funcname, format_type_be(funcrettype)),
errmsg("function \"%s\" in FROM has unsupported return type %s",
funcname, format_type_be(funcrettype)),
parser_errposition(pstate, exprLocation(funcexpr))));
/* Finish off the RangeTblFunction and add it to the RTE's list */
@@ -1688,7 +1688,7 @@ addRangeTableEntryForTableFunc(ParseState *pstate,
/* fill in any unspecified alias columns */
if (numaliases < list_length(tf->colnames))
eref->colnames = list_concat(eref->colnames,
list_copy_tail(tf->colnames, numaliases));
list_copy_tail(tf->colnames, numaliases));
rte->eref = eref;
@@ -1911,8 +1911,8 @@ addRangeTableEntryForCTE(ParseState *pstate,
ctequery->returningList == NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("WITH query \"%s\" does not have a RETURNING clause",
cte->ctename),
errmsg("WITH query \"%s\" does not have a RETURNING clause",
cte->ctename),
parser_errposition(pstate, rv->location)));
}
@@ -2529,7 +2529,7 @@ expandTupleDesc(TupleDesc tupdesc, Alias *eref, int count, int offset,
* what type the Const claims to be.
*/
*colvars = lappend(*colvars,
makeNullConst(INT4OID, -1, InvalidOid));
makeNullConst(INT4OID, -1, InvalidOid));
}
}
if (aliascell)
@@ -2696,9 +2696,9 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
if (att_tup->attisdropped)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("column \"%s\" of relation \"%s\" does not exist",
NameStr(att_tup->attname),
get_rel_name(rte->relid))));
errmsg("column \"%s\" of relation \"%s\" does not exist",
NameStr(att_tup->attname),
get_rel_name(rte->relid))));
*vartype = att_tup->atttypid;
*vartypmod = att_tup->atttypmod;
*varcollid = att_tup->attcollation;
@@ -3185,11 +3185,11 @@ errorMissingRTE(ParseState *pstate, RangeVar *relation)
if (rte)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_TABLE),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
relation->relname),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
relation->relname),
(badAlias ?
errhint("Perhaps you meant to reference the table alias \"%s\".",
badAlias) :
errhint("Perhaps you meant to reference the table alias \"%s\".",
badAlias) :
errhint("There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
rte->eref->aliasname)),
parser_errposition(pstate, relation->location)));
@@ -3248,8 +3248,8 @@ errorMissingColumn(ParseState *pstate,
errmsg("column %s.%s does not exist", relname, colname) :
errmsg("column \"%s\" does not exist", colname),
state->rfirst ? closestfirst ?
errhint("Perhaps you meant to reference the column \"%s.%s\".",
state->rfirst->eref->aliasname, closestfirst) :
errhint("Perhaps you meant to reference the column \"%s.%s\".",
state->rfirst->eref->aliasname, closestfirst) :
errhint("There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
colname, state->rfirst->eref->aliasname) : 0,
parser_errposition(pstate, location)));

View File

@@ -587,7 +587,7 @@ transformAssignedExpr(ParseState *pstate,
colname,
format_type_be(attrtype),
format_type_be(type_id)),
errhint("You will need to rewrite or cast the expression."),
errhint("You will need to rewrite or cast the expression."),
parser_errposition(pstate, exprLocation(orig_expr))));
}
@@ -777,7 +777,7 @@ transformAssignmentIndirection(ParseState *pstate,
parser_errposition(pstate, location)));
get_atttypetypmodcoll(typrelid, attnum,
&fieldTypeId, &fieldTypMod, &fieldCollation);
&fieldTypeId, &fieldTypMod, &fieldCollation);
/* recurse to create appropriate RHS for field assign */
rhs = transformAssignmentIndirection(pstate,
@@ -837,7 +837,7 @@ transformAssignmentIndirection(ParseState *pstate,
targetName,
format_type_be(targetTypeId),
format_type_be(exprType(rhs))),
errhint("You will need to rewrite or cast the expression."),
errhint("You will need to rewrite or cast the expression."),
parser_errposition(pstate, location)));
else
ereport(ERROR,
@@ -847,7 +847,7 @@ transformAssignmentIndirection(ParseState *pstate,
targetName,
format_type_be(targetTypeId),
format_type_be(exprType(rhs))),
errhint("You will need to rewrite or cast the expression."),
errhint("You will need to rewrite or cast the expression."),
parser_errposition(pstate, location)));
}
@@ -999,9 +999,9 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
if (attrno == InvalidAttrNumber)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("column \"%s\" of relation \"%s\" does not exist",
name,
RelationGetRelationName(pstate->p_target_relation)),
errmsg("column \"%s\" of relation \"%s\" does not exist",
name,
RelationGetRelationName(pstate->p_target_relation)),
parser_errposition(pstate, col->location)));
/*

View File

@@ -80,8 +80,8 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName,
case 1:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("improper %%TYPE reference (too few dotted names): %s",
NameListToString(typeName->names)),
errmsg("improper %%TYPE reference (too few dotted names): %s",
NameListToString(typeName->names)),
parser_errposition(pstate, typeName->location)));
break;
case 2:
@@ -124,8 +124,8 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName,
else
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("column \"%s\" of relation \"%s\" does not exist",
field, rel->relname),
errmsg("column \"%s\" of relation \"%s\" does not exist",
field, rel->relname),
parser_errposition(pstate, typeName->location)));
}
else
@@ -334,8 +334,8 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ)
if (!((Form_pg_type) GETSTRUCT(typ))->typisdefined)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("type modifier cannot be specified for shell type \"%s\"",
TypeNameToString(typeName)),
errmsg("type modifier cannot be specified for shell type \"%s\"",
TypeNameToString(typeName)),
parser_errposition(pstate, typeName->location)));
typmodin = ((Form_pg_type) GETSTRUCT(typ))->typmodin;
@@ -385,7 +385,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ)
if (!cstr)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("type modifiers must be simple constants or identifiers"),
errmsg("type modifiers must be simple constants or identifiers"),
parser_errposition(pstate, typeName->location)));
datums[n++] = CStringGetDatum(cstr);
}

View File

@@ -136,7 +136,7 @@ static void transformColumnType(CreateStmtContext *cxt, ColumnDef *column);
static void setSchemaName(char *context_schema, char **stmt_schema_name);
static void transformPartitionCmd(CreateStmtContext *cxt, PartitionCmd *cmd);
static Const *transformPartitionBoundValue(ParseState *pstate, A_Const *con,
const char *colName, Oid colType, int32 colTypmod);
const char *colName, Oid colType, int32 colTypmod);
/*
@@ -261,7 +261,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
if (stmt->inhRelations && !stmt->partbound)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("cannot create partitioned table as inheritance child")));
errmsg("cannot create partitioned table as inheritance child")));
}
/*
@@ -452,7 +452,7 @@ generateSerialExtraStmts(CreateStmtContext *cxt, ColumnDef *column,
*/
if (seqtypid)
seqstmt->options = lcons(makeDefElem("as",
(Node *) makeTypeNameFromOid(seqtypid, -1),
(Node *) makeTypeNameFromOid(seqtypid, -1),
-1),
seqstmt->options);
@@ -668,12 +668,12 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple identity specifications for column \"%s\" of table \"%s\"",
column->colname, cxt->relation->relname),
column->colname, cxt->relation->relname),
parser_errposition(cxt->pstate,
constraint->location)));
generateSerialExtraStmts(cxt, column,
typeOid, constraint->options, true,
typeOid, constraint->options, true,
NULL, NULL);
column->identity = constraint->generated_when;
@@ -915,7 +915,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
if (cxt->isforeign)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("LIKE is not supported for creating foreign tables")));
errmsg("LIKE is not supported for creating foreign tables")));
relation = relation_openrv(table_like_clause->relation, AccessShareLock);
@@ -1076,7 +1076,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
stmt->objtype = OBJECT_COLUMN;
stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname),
makeString(cxt->relation->relname),
makeString(cxt->relation->relname),
makeString(def->colname));
stmt->comment = comment;
@@ -1133,7 +1133,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
/* Copy comment on constraint */
if ((table_like_clause->options & CREATE_TABLE_LIKE_COMMENTS) &&
(comment = GetComment(get_relation_constraint_oid(RelationGetRelid(relation),
n->conname, false),
n->conname, false),
ConstraintRelationId,
0)) != NULL)
{
@@ -1141,7 +1141,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
stmt->objtype = OBJECT_TABCONSTRAINT;
stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname),
makeString(cxt->relation->relname),
makeString(cxt->relation->relname),
makeString(n->conname));
stmt->comment = comment;
@@ -1546,8 +1546,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert whole-row table reference"),
errdetail("Index \"%s\" contains a whole-row table reference.",
RelationGetRelationName(source_idx))));
errdetail("Index \"%s\" contains a whole-row table reference.",
RelationGetRelationName(source_idx))));
index->whereClause = pred_tree;
}
@@ -1753,8 +1753,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
if (cxt->pkey != NULL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("multiple primary keys for table \"%s\" are not allowed",
cxt->relation->relname),
errmsg("multiple primary keys for table \"%s\" are not allowed",
cxt->relation->relname),
parser_errposition(cxt->pstate, constraint->location)));
cxt->pkey = index;
@@ -1835,8 +1835,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
if (OidIsValid(get_index_constraint(index_oid)))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("index \"%s\" is already associated with a constraint",
index_name),
errmsg("index \"%s\" is already associated with a constraint",
index_name),
parser_errposition(cxt->pstate, constraint->location)));
/* Perform validity checks on the index */
@@ -1924,7 +1924,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
}
else
attform = SystemAttributeDefinition(attnum,
heap_rel->rd_rel->relhasoids);
heap_rel->rd_rel->relhasoids);
attname = pstrdup(NameStr(attform->attname));
/*
@@ -1942,7 +1942,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("index \"%s\" does not have default sorting behavior", index_name),
errdetail("Cannot create a primary key or unique constraint using such an index."),
parser_errposition(cxt->pstate, constraint->location)));
parser_errposition(cxt->pstate, constraint->location)));
constraint->keys = lappend(constraint->keys, makeString(attname));
}
@@ -2086,13 +2086,13 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column \"%s\" appears twice in primary key constraint",
key),
parser_errposition(cxt->pstate, constraint->location)));
parser_errposition(cxt->pstate, constraint->location)));
else
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column \"%s\" appears twice in unique constraint",
key),
parser_errposition(cxt->pstate, constraint->location)));
errmsg("column \"%s\" appears twice in unique constraint",
key),
parser_errposition(cxt->pstate, constraint->location)));
}
}
@@ -2396,7 +2396,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
/* take care of the where clause */
*whereClause = transformWhereClause(pstate,
(Node *) copyObject(stmt->whereClause),
(Node *) copyObject(stmt->whereClause),
EXPR_KIND_WHERE,
"WHERE");
/* we have to fix its collations too */
@@ -2787,7 +2787,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt,
AlterSeqStmt *altseqstmt = makeNode(AlterSeqStmt);
altseqstmt->sequence = makeRangeVar(get_namespace_name(get_rel_namespace(seq_relid)),
get_rel_name(seq_relid),
get_rel_name(seq_relid),
-1);
altseqstmt->options = list_make1(makeDefElem("as", (Node *) makeTypeNameFromOid(typeOid, -1), -1));
altseqstmt->for_identity = true;
@@ -2863,7 +2863,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt,
seqstmt = makeNode(AlterSeqStmt);
seq_relid = linitial_oid(seqlist);
seqstmt->sequence = makeRangeVar(get_namespace_name(get_rel_namespace(seq_relid)),
get_rel_name(seq_relid), -1);
get_rel_name(seq_relid), -1);
seqstmt->options = newseqopts;
seqstmt->for_identity = true;
seqstmt->missing_ok = false;
@@ -3313,8 +3313,8 @@ transformPartitionBound(ParseState *pstate, Relation parent,
if (spec->strategy != PARTITION_STRATEGY_LIST)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("invalid bound specification for a list partition"),
parser_errposition(pstate, exprLocation((Node *) spec))));
errmsg("invalid bound specification for a list partition"),
parser_errposition(pstate, exprLocation((Node *) spec))));
/* Get the only column's name in case we need to output an error */
if (key->partattrs[0] != 0)
@@ -3322,8 +3322,8 @@ transformPartitionBound(ParseState *pstate, Relation parent,
key->partattrs[0]);
else
colname = deparse_expression((Node *) linitial(partexprs),
deparse_context_for(RelationGetRelationName(parent),
RelationGetRelid(parent)),
deparse_context_for(RelationGetRelationName(parent),
RelationGetRelid(parent)),
false, false);
/* Need its type data too */
coltype = get_partition_col_typid(key, 0);
@@ -3370,8 +3370,8 @@ transformPartitionBound(ParseState *pstate, Relation parent,
if (spec->strategy != PARTITION_STRATEGY_RANGE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("invalid bound specification for a range partition"),
parser_errposition(pstate, exprLocation((Node *) spec))));
errmsg("invalid bound specification for a range partition"),
parser_errposition(pstate, exprLocation((Node *) spec))));
if (list_length(spec->lowerdatums) != partnatts)
ereport(ERROR,
@@ -3397,8 +3397,8 @@ transformPartitionBound(ParseState *pstate, Relation parent,
else if (seen_unbounded)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("cannot specify finite value after UNBOUNDED"),
parser_errposition(pstate, exprLocation((Node *) ldatum))));
errmsg("cannot specify finite value after UNBOUNDED"),
parser_errposition(pstate, exprLocation((Node *) ldatum))));
}
seen_unbounded = false;
foreach(cell1, spec->upperdatums)
@@ -3411,8 +3411,8 @@ transformPartitionBound(ParseState *pstate, Relation parent,
else if (seen_unbounded)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("cannot specify finite value after UNBOUNDED"),
parser_errposition(pstate, exprLocation((Node *) rdatum))));
errmsg("cannot specify finite value after UNBOUNDED"),
parser_errposition(pstate, exprLocation((Node *) rdatum))));
}
/* Transform all the constants */
@@ -3435,8 +3435,8 @@ transformPartitionBound(ParseState *pstate, Relation parent,
else
{
colname = deparse_expression((Node *) list_nth(partexprs, j),
deparse_context_for(RelationGetRelationName(parent),
RelationGetRelid(parent)),
deparse_context_for(RelationGetRelationName(parent),
RelationGetRelid(parent)),
false, false);
++j;
}
@@ -3491,7 +3491,7 @@ transformPartitionBound(ParseState *pstate, Relation parent,
*/
static Const *
transformPartitionBoundValue(ParseState *pstate, A_Const *con,
const char *colName, Oid colType, int32 colTypmod)
const char *colName, Oid colType, int32 colTypmod)
{
Node *value;
@@ -3510,8 +3510,8 @@ transformPartitionBoundValue(ParseState *pstate, A_Const *con,
if (value == NULL)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("specified value cannot be cast to type %s for column \"%s\"",
format_type_be(colType), colName),
errmsg("specified value cannot be cast to type %s for column \"%s\"",
format_type_be(colType), colName),
parser_errposition(pstate, con->location)));
/* Simplify the expression, in case we had a coercion */
@@ -3522,8 +3522,8 @@ transformPartitionBoundValue(ParseState *pstate, A_Const *con,
if (!IsA(value, Const))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("specified value cannot be cast to type %s for column \"%s\"",
format_type_be(colType), colName),
errmsg("specified value cannot be cast to type %s for column \"%s\"",
format_type_be(colType), colName),
errdetail("The cast requires a non-immutable conversion."),
errhint("Try putting the literal value in single quotes."),
parser_errposition(pstate, con->location)));