Skip to content

Conversation

@jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Jan 21, 2026

This PR exists for a couple of reasons:

aqrln and others added 15 commits January 14, 2026 15:31
Remove `ScalarCondition::InTemplate` and `ScalarCondition::NotInTemplate`
and instead add placeholders as the third variant in
`ConditionListValue`. This simplifies the implementation and makes
some illegal states unrepresentable (previously it was possible to
construct `ScalarCondition::InTemplate`/`ScalarCondition::NotInTemplate`
with arbitrary `PrismaValue`s and with field references).
Require placeholder types to be specified in the JSON
protocol representation of the placholders and parse them in
`JsonProtocolAdapter`.
Generator calls should only be parsed when we expect a scalar.

This change also adds some debug assertions to ensure that the return
types are correct. For performance and size reasons, we do not compile
these checks in release builds because generators do not come from user
input and cannot be represented in the JSON protocol.
Extract the repetitive `ValidationError::invalid_argument_type`
construction code and mark it as `#[inline(never)]` to save some extra
bytes in the compiled binary since it's an error path and therefore not
performance critical.
Fix a typo in invalid argument value validation error: remove a
duplicate "argument" word that also had a typo in it.
`matches`/`not_matches` operations needed to be adjusted to accept
placeholders. The corresponding fields in DMMF were already marked as
parameterizable so QC panicked in Client tests here.
Copilot AI review requested due to automatic review settings January 21, 2026 12:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates fixes for query compiler (QC) parameterization, specifically addressing panic issues when placeholders are used in full-text search operations. The changes refactor how placeholders are handled throughout the query pipeline, remove the unused Param scalar type, and add proper validation to prevent placeholders from being used in non-parameterizable fields.

Changes:

  • Refactored placeholder handling by removing InTemplate/NotInTemplate variants in favor of using Placeholder within existing In/NotIn variants
  • Added is_parameterizable flag to input fields with comprehensive marking of which fields accept placeholders (filters, data fields) vs which don't (take, skip, orderBy)
  • Fixed full-text search to properly handle placeholder expressions instead of just string values
  • Added validation to reject placeholders in non-parameterizable locations with helpful error messages

Reviewed changes

Copilot reviewed 44 out of 46 changed files in this pull request and generated no comments.

Show a summary per file
File Description
query-engine/connectors/mongodb-query-connector/src/filter.rs Added unimplemented handlers for Placeholder in list conditions (MongoDB doesn't support QC yet)
query-compiler/schema/src/query_schema.rs Removed unused Param scalar type variant
query-compiler/schema/src/input_types.rs Added is_parameterizable field and methods to InputField with tests
query-compiler/schema/src/build/input_types/objects/*.rs Marked appropriate filter and order-by fields as parameterizable
query-compiler/schema/src/build/input_types/fields/*.rs Marked data input fields and filter fields as parameterizable where appropriate
query-compiler/request-handlers/src/protocols/json/protocol_adapter.rs Updated placeholder parsing to deserialize full Placeholder struct
query-compiler/query-structure/src/order_by.rs Changed search field type from String to PrismaValue to support placeholders
query-compiler/query-structure/src/filter/scalar/* Removed InTemplate/NotInTemplate variants, added Placeholder to ConditionListValue
query-compiler/query-compiler/src/translate/query/read.rs Updated to use Placeholder struct and In variant instead of InTemplate
query-compiler/query-builders/sql-query-builder/src/*.rs Added support for converting placeholder values to SQL expressions in filters and ordering
quaint/src/visitor/*.rs Changed matches signature to accept Expression instead of Cow for placeholder support
quaint/src/ast/*.rs Updated Compare, Comparable trait, and related types for Expression-based matches
query-compiler/dmmf/src/*.rs Added is_parameterizable field to DMMF serialization
query-compiler/core/src/query_document/parser.rs Added comprehensive placeholder validation with type checking
query-compiler/core-tests/tests/*.rs Added test cases for placeholder validation in take/skip fields
libs/user-facing-errors/src/query_engine/validation.rs Fixed typo: "agument" to "argument"
libs/prisma-value/src/lib.rs Added serde flatten and into_placeholder helper method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 21, 2026

Merging this PR will not alter performance

✅ 11 untouched benchmarks
⏩ 11 skipped benchmarks1


Comparing feat/minor-fixes-on-qc-parameterization (fd569fa) with main (9d6ad21)

Open in CodSpeed

Footnotes

  1. 11 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link
Contributor

Wasm Query Compiler File Size

Engine This PR Base branch Diff
Postgres 3.484MiB 3.475MiB 9.327KiB
Postgres (gzip) 1.141MiB 1.134MiB 6.913KiB
Postgres (size-optimized) 1.757MiB 1.742MiB 16.152KiB
Postgres (size-optimized, gzip) 691.459KiB 684.584KiB 6.876KiB
Mysql 3.437MiB 3.428MiB 9.270KiB
Mysql (gzip) 1.122MiB 1.115MiB 7.042KiB
Mysql (size-optimized) 1.727MiB 1.711MiB 16.066KiB
Mysql (size-optimized, gzip) 680.632KiB 673.863KiB 6.770KiB
Sqlite 3.356MiB 3.349MiB 7.459KiB
Sqlite (gzip) 1.095MiB 1.088MiB 6.885KiB
Sqlite (size-optimized) 1.682MiB 1.667MiB 15.193KiB
Sqlite (size-optimized, gzip) 664.329KiB 657.507KiB 6.822KiB
SQL Server 3.579MiB 3.570MiB 8.894KiB
SQL Server (gzip) 1.159MiB 1.150MiB 8.564KiB
SQL Server (size-optimized) 1.758MiB 1.742MiB 16.513KiB
SQL Server (size-optimized, gzip) 694.864KiB 687.907KiB 6.958KiB
CockroachDB 3.535MiB 3.525MiB 9.262KiB
CockroachDB (gzip) 1.160MiB 1.152MiB 8.150KiB
CockroachDB (size-optimized) 1.781MiB 1.765MiB 16.455KiB
CockroachDB (size-optimized, gzip) 701.302KiB 694.466KiB 6.836KiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants