MCPcopy Create free account
hub / github.com/apache/cloudberry / parser_errposition

Function parser_errposition

src/backend/parser/parse_node.c:110–125  ·  view source on GitHub ↗

* parser_errposition * Report a parse-analysis-time cursor position, if possible. * * This is expected to be used within an ereport() call. The return value * is a dummy (always 0, in fact). * * The locations stored in raw parsetrees are byte offsets into the source * string. We have to convert them to 1-based character indexes for reporting * to clients. (We do things this way to avoi

Source from the content-addressed store, hash-verified

108 * expensive than storing token offsets.)
109 */
110void
111parser_errposition(ParseState *pstate, int location)
112{
113 int pos;
114
115 /* No-op if location was not provided */
116 if (location < 0)
117 return;
118 /* Can't do anything if source text is not available */
119 if (pstate == NULL || pstate->p_sourcetext == NULL)
120 return;
121 /* Convert offset to character number */
122 pos = pg_mbstrlen_with_len(pstate->p_sourcetext, location) + 1;
123 /* And pass it to the ereport mechanism */
124 errposition(pos);
125}
126
127
128/*

Callers 15

plpgsql_post_column_refFunction · 0.85
resolve_column_refFunction · 0.85
ExecVacuumFunction · 0.85
ExecReindexFunction · 0.85
ProcessCopyOptionsFunction · 0.85
CreateTriggerFiringOnFunction · 0.85
DefineTypeFunction · 0.85
CreateProfileFunction · 0.85

Calls 2

pg_mbstrlen_with_lenFunction · 0.85
errpositionFunction · 0.50

Tested by

no test coverage detected