plpgsql: report proper line number for errors in variable initialization.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 31 Oct 2021 16:43:47 +0000 (12:43 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 31 Oct 2021 16:43:47 +0000 (12:43 -0400)
commitacb2d7d5d2301f07d5857ee252995e62ce9e7055
tree0fdcadd97218dbeb0b85ea0e99b76e521d1fcccc
parentfd2706589a7da4be6f6998befdf8e5fdea1565b8
plpgsql: report proper line number for errors in variable initialization.

Previously, we pointed at the surrounding block's BEGIN keyword.
If there are multiple variables being initialized in a DECLARE section,
this isn't good enough: it can be quite confusing and unhelpful.
We do know where the variable's declaration started, so it just takes
a tiny bit more error-reporting infrastructure to use that.

Discussion: https://postgr.es/m/713975.1635530414@sss.pgh.pa.us
src/pl/plpgsql/src/expected/plpgsql_domain.out
src/pl/plpgsql/src/expected/plpgsql_varprops.out
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/plpgsql.h
src/test/regress/expected/domain.out
src/test/regress/expected/plpgsql.out