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

Function plpgsql_scanner_errposition

src/pl/plpgsql/src/pl_scanner.c:474–488  ·  view source on GitHub ↗

* plpgsql_scanner_errposition * Report an error cursor position, if possible. * * This is expected to be used within an ereport() call. The return value * is a dummy (always 0, in fact). * * Note that this can only be used for messages emitted during initial * parsing of a plpgsql function, since it requires the scanorig string * to still be available. */

Source from the content-addressed store, hash-verified

472 * to still be available.
473 */
474void
475plpgsql_scanner_errposition(int location)
476{
477 int pos;
478
479 if (location < 0 || scanorig == NULL)
480 return; /* no-op if location is unknown */
481
482 /* Convert byte offset to character number */
483 pos = pg_mbstrlen_with_len(scanorig, location) + 1;
484 /* And pass it to the ereport mechanism */
485 (void) internalerrposition(pos);
486 /* Also pass the function body string */
487 internalerrquery(scanorig);
488}
489
490/*
491 * plpgsql_yyerror

Callers 1

plpgsql_yyerrorFunction · 0.85

Calls 3

pg_mbstrlen_with_lenFunction · 0.85
internalerrpositionFunction · 0.50
internalerrqueryFunction · 0.50

Tested by

no test coverage detected