Repository navigation
Recognise underscores and digits in PostgreSQL dollar-quote tags - #249
Merged
Merged
Conversation
Signed-off-by: Yusuf Efe <120668197+yuefdev@users.noreply.github.com>
huandu
requested changes
Oct 20, 2026
huandu
left a comment
Owner
There was a problem hiding this comment.
Requesting changes for one parser regression introduced by this change. The tag grammar itself is correct, and the reported cases now match PostgreSQL. However, the scanner still treats $ as a quote opener without checking the preceding token, which now also affects _-leading tags. There are two smaller cleanup suggestions as well. Details inline.
huandu
approved these changes
Oct 23, 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.
PostgreSQL dollar-quote tags may start with an underscore and contain digits after the first character. The interpolator currently accepts only letters, so
SELECT $tag_1$literal $2$tag_1$, $1tries to bind the literal$2and fails with a missing-argument error.Recognise those tag characters while keeping a leading digit out of the tag. Tests preserve placeholders inside the literal and still bind the following
$1; five tag cases fail before the fix. Empty and letter-only tags, Unicode letters and a digit-leading non-tag are also covered.go test ./... -count=1,go vet ./...and formatting checks for the changed files pass. The tag rules are described in PostgreSQL's lexical syntax documentation.