* 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. */
| 472 | * to still be available. |
| 473 | */ |
| 474 | void |
| 475 | plpgsql_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 |
no test coverage detected