Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christoph Berg <myon@debian.org>
Cc: Michael Banck <mbanck@gmx.net>, Tommy Pavlicek <tommypav122@gmail.com>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, pgsql-hackers@lists.postgresql.org, jian.universality@gmail.com
Date: 2024-09-27T17:54:44Z
Lists: pgsql-hackers
Attachments
- v2-0001-better-extension-error-reporting.patch (text/x-diff) patch v2-0001
- v2-0002-handle-statement-locations-better.patch (text/x-diff) patch v2-0002
Christoph Berg <myon@debian.org> writes: > Re: Tom Lane >> (It might be worth some effort to trim away comments appearing >> just before a command, but I didn't tackle that here.) > The "error when psql" comments do look confusing, but I guess in other > places the comment just before the query adds valuable context, so I'd > say leaving the comments in is ok. It looks like if we did want to suppress that, the right fix is to make gram.y track statement start locations more honestly, as in 0002 attached (0001 is the same as before). This'd add a few cycles per grammar nonterminal reduction, which is kind of annoying but probably is negligible in the grand scheme of things. Still, I'd not propose it just for this. But if memory serves, we've had previous complaints about pg_stat_statements failing to strip leading comments from queries, and this'd fix that. I think it likely also improves error cursor positioning for cases involving empty productions --- I'm a tad surprised that no other regression cases changed. regards, tom lane
Commits
-
Strip Windows newlines from extension script files manually.
- 6cfb3a337469 18.0 landed
-
Read extension script files in text not binary mode.
- 924e03917d6f 18.0 landed
-
Improve reporting of errors in extension script files.
- 774171c4f640 18.0 landed
-
Improve parser's reporting of statement start locations.
- 14e5680eee19 18.0 landed
-
Extend ALTER OPERATOR to allow setting more optimization attributes.
- 2b5154beab79 17.0 landed
-
Core support for "extensions", which are packages of SQL objects.
- d9572c4e3b47 9.1.0 cited