Repository navigation
feat: type cast placeholders in every clause and subquery - #71
Merged
Merged
Conversation
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.
Summary
A placeholder written as the direct operand of
::typeorCAST(... AS type)is now typed by that cast wherever it appears in an acceptedSELECT,INSERT,UPDATE, orDELETE, and every placeholder binds in the order the query writes it. This makes dynamicORDER BY CASEsorts, castLIMIT/OFFSETpages, and placeholders insideEXISTS,IN (SELECT ...), and other subqueries compile instead of failing the placeholder accounting check.Changes
WHEREone andOFFSET ... LIMIT ...binds the offset first.GROUP BY,HAVING,ORDER BY,LIMIT,OFFSET,FETCH,WITHbodies, and subqueries at any depth, in reads and writes.LIMITrow count orOFFSETvalue islimitoroffset; every other newly accepted indexed cast placeholder isparam<N>. Placeholders accepted before keep their names, types, and binding positions.WITHbodies, sharing and conflicts, rejections, generated-source compilation, and PostgreSQL execution of a dynamic sort, a cast page in both clause orders, and anEXISTSmembership check.Scope and non-goals
ORDER BY $1,LIMIT $1 + 1,FETCH FIRST $1 ROWS ONLY, an uncast subquery placeholder, orlower(name) = :name, is still rejected with the existing message, as is a placeholder that is not the cast's direct operand, such as(:x)::int.ONconditions, conflict-clause predicates, andRETURNINGitems are unchanged.WITHbodies are not otherwise analyzed: their placeholders are typed only by their casts, and a projected scalar subquery remains an unsupported projection.