Improve plpgsql's error messages for incorrect %TYPE and %ROWTYPE.
Tom Lane <tgl@sss.pgh.pa.us>
Improve plpgsql's error messages for incorrect %TYPE and %ROWTYPE. If one of these constructs referenced a nonexistent object, we'd fall through to feeding the whole construct to the core parser, which would reject it with a "syntax error" message. That's pretty unhelpful and misleading. There's no good reason for plpgsql_parse_wordtype and friends not to throw a useful error for incorrect input, so make them do that instead of returning NULL. Discussion: https://postgr.es/m/1964516.1708977740@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/pl/plpgsql/src/expected/plpgsql_misc.out | modified | +36 −0 |
| src/pl/plpgsql/src/pl_comp.c | modified | +29 −53 |
| src/pl/plpgsql/src/pl_gram.y | modified | +1 −4 |
| src/pl/plpgsql/src/sql/plpgsql_misc.sql | modified | +17 −0 |
Discussion
- Better error messages for %TYPE and %ROWTYPE in plpgsql 7 messages · 2024-02-26 → 2024-02-27