Hello In a thread about repack [1] Alvaro pointed out that the parser support for psql is a hack, and since I was already interested in making the parser available as a library for different projects I decided to take a look into that.
Shortly after starting, Claude pointed out a trivial bug where a long chain can cause a stack overflow crash during error reporting. Since this requires a 1 line fix, I attached a patch for it. I'm not sure if we want to add a test case for something like this, but since it doesn't take much time to run or isn't too complex, the patch includes one. [1]: https://postgr.es/m/awVFP-EHuqyMYv51%40alvherre.pgsql
v1-0001-Prevent-stack-overflow-in-exprLocation.patch
Description: Binary data
