/* Fill in fields that don't start at null/false/zero */
pstate->p_next_resno = 1;
pstate->p_resolve_unknowns = true;
if (parentParseState)
{
pstate->p_sourcetext = parentParseState->p_sourcetext; /* all hooks are copied from parent */
pstate->p_pre_columnref_hook = parentParseState->p_pre_columnref_hook;
pstate->p_post_columnref_hook = parentParseState->p_post_columnref_hook;
pstate->p_paramref_hook = parentParseState->p_paramref_hook;
pstate->p_coerce_param_hook = parentParseState->p_coerce_param_hook;
pstate->p_ref_hook_state = parentParseState->p_ref_hook_state; /* query environment stays in context for the whole parse analysis */
pstate->p_queryEnv = parentParseState->p_queryEnv;
}
return pstate;
}
/* *free_parsestate *ReleaseaParseStateandanysubsidiaryresources.
*/ void
free_parsestate(ParseState *pstate)
{ /* *Checkthatwedidnotproducetoomanyresnos;attheveryleastwe *cannotallowmorethan2^16,sincethatwouldexceedtherangeofa *AttrNumber.ItseemssafesttouseMaxTupleAttributeNumber.
*/ if (pstate->p_next_resno - 1 > MaxTupleAttributeNumber)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_COLUMNS),
errmsg("target lists can have at most %d entries",
MaxTupleAttributeNumber)));
if (pstate->p_target_relation != NULL)
table_close(pstate->p_target_relation, NoLock);
pfree(pstate);
}
/* *parser_errposition *Reportaparse-analysis-timecursorposition,ifpossible. * *Thisisexpectedtobeusedwithinanereport()call.Thereturnvalue *isadummy(always0,infact). * *Thelocationsstoredinrawparsetreesarebyteoffsetsintothesource *string.Wehavetoconvertthemto1-basedcharacterindexesforreporting *toclients.(Wedothingsthiswaytoavoidunnecessaryoverheadinthe *normalnon-errorcase:computingcharacterindexeswouldbemuchmore *expensivethanstoringtokenoffsets.)
*/ int
parser_errposition(ParseState *pstate, int location)
{ int pos;
/* No-op if location was not provided */ if (location < 0) return0; /* Can't do anything if source text is not available */ if (pstate == NULL || pstate->p_sourcetext == NULL) return0; /* Convert offset to character number */
pos = pg_mbstrlen_with_len(pstate->p_sourcetext, location) + 1; /* And pass it to the ereport mechanism */ return errposition(pos);
}
/* *Determinetheactualcontainertype,smashinganydomain.Inthe *assignmentcasethecalleralreadydidthis,sinceitalsoneedsto *knowtheactualcontainertype.
*/ if (!isAssignment)
transformContainerType(&containerType, &containerTypMod);
/* *Verifythatthecontainertypeissubscriptable,andgetitssupport *functionsandtypelem.
*/
sbsroutines = getSubscriptingRoutines(containerType, &elementType); if (!sbsroutines)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("cannot subscript type %s because it does not support subscripting",
format_type_be(containerType)),
parser_errposition(pstate, exprLocation(containerBase))));
sbsref->refcontainertype = containerType;
sbsref->refelemtype = elementType; /* refrestype is to be set by container-specific logic */
sbsref->reftypmod = containerTypMod; /* refcollid will be set by parse_collate.c */ /* refupperindexpr, reflowerindexpr are to be set by container logic */
sbsref->refexpr = (Expr *) containerBase;
sbsref->refassgnexpr = NULL; /* caller will fill if it's an assignment */
/* *Verifywegotavalidtype(thisdefends,forexample,againstsomeone *usingarray_subscript_handlerastypsubscriptwithoutsettingtypelem).
*/ if (!OidIsValid(sbsref->refrestype))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("cannot subscript type %s because it does not support subscripting",
format_type_be(containerType))));
con = makeConst(typeid,
-1, /* typmod -1 is OK for all cases */
InvalidOid, /* all cases are uncollatable types */
typelen,
val, false,
typebyval);
con->location = aconst->location;
return con;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet am 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.