Enable bound parameters for PostgreSQL - #774
Merged
Merged
Conversation
josetduarte
force-pushed
the
feat/postgres-parameters
branch
2 times, most recently
from
July 21, 2026 14:41
e75ec41 to
bbd2910
Compare
josetduarte
force-pushed
the
feat/postgres-parameters
branch
from
July 21, 2026 15:13
bbd2910 to
2f43eec
Compare
Contributor
|
@mdipierro this looks very good. @josetduarte when/if this is merged a nice follow up would be to add the json and geo functions, so postgres can be completely modernized to the new way of doing things in pydal. |
Contributor
Author
|
@mdipierro can you check this please? |
Keep upstream Unicode conversion alongside PostgreSQL id and reference parameter adaptation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Include bound values in cache keys, preserve Unicode pattern semantics and parameter order, and retain RETURNING when INSERT falls back to the legacy compiler path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Sep 15, 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.
Summary
Enable bound parameters by default for PostgreSQL/psycopg2 through the driver-specific
PostgresPsycoCompiler, using%splaceholders. Generic PostgreSQL and JDBC compilers remain inline.RETURNINGbehavior in both the compiler and legacy fallback paths, including renamed identifiers containing percent signs.Upstream integration
Merged upstream
masterwithout rewriting the existing PR history. Kept the upstream Unicode compatibility fix alongside the PR's ID and reference adaptation.Regression coverage
Focused cases cover cache key compatibility and parameter isolation, composed LIKE/ILIKE/contains expressions, Unicode and NULL patterns, typed references, and INSERT behavior with compiler fallback, disabled compilation, empty rows, composite keys, renamed IDs and JDBC. The affected modules also run against an isolated PostgreSQL 16 database.
Scope
This change targets the existing PostgreSQL/psycopg2 parametrization work. New JSON/GIS operations and parameterization of additional drivers remain outside this PR.
Known upstream issue
The existing PostgreSQL recursive CTE fixture (
tests.sql.TestSubselect.testCTE) uses a double-quoted space as a SQL string literal and raisesUndefinedColumn. The same failure occurs on unchanged upstreamdcf76747; this unrelated fixture is left outside the scope of this PR.