plpgsql: report proper line number for errors in variable initialization.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: acb2d7d5d2301f07d5857ee252995e62ce9e7055
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-10-31T16:43:47Z
Releases: 15.0
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

Files

Discussion