Repository navigation
fix(plpgsql): locate syntax errors with plpgsql_check instead of flagging the whole body - #862
Merged
Merged
Conversation
This was referenced Oct 17, 2026
psteinroe
force-pushed
the
fix/plpgsql-syntax-with-check
branch
from
October 18, 2026 07:48
4867ccc to
86a7ff6
Compare
… syntax error for checked functions
psteinroe
force-pushed
the
fix/plpgsql-syntax-with-check
branch
from
October 18, 2026 17:57
86a7ff6 to
ec163ef
Compare
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With plpgsql_check installed, editing a PL/pgSQL function no longer underlines the entire function body.
Located compile errors
Errors that stop the function from compiling, like a misspelled
DECLARE, a missingEND IFor an unknown variable, come from plpgsql_check without a statement. They only have the body and a character position, so we fell back to the whole body. They now point at the token at that position, or at the delimiter insyntax error at or near ";". Errors at end of input still span the body.Whole-body libpg_query error
libpg_query's PL/pgSQL syntax error has no usable location:
cursorposis always 0, and its "near line N" is the last parsed statement, not the error. It is now dropped for every function that plpgsql_check actually checked. It is still reported when plpgsql_check can't check the function: no database, extension missing or disabled, the function fails to create, or no trigger uses a trigger function.#860(draft) also touchesdatabase_diagnostics; whichever merges second needs a small rebase.Refs #179