Skip to content

fix(postgresql): support :: casts on parameter/variable placeholders#2664

Open
nguyenmp wants to merge 1 commit into
taozhi8833998:masterfrom
tryretool:marknguyen/fix_cast_on_parameters
Open

fix(postgresql): support :: casts on parameter/variable placeholders#2664
nguyenmp wants to merge 1 commit into
taozhi8833998:masterfrom
tryretool:marknguyen/fix_cast_on_parameters

Conversation

@nguyenmp

@nguyenmp nguyenmp commented Jun 3, 2026

Copy link
Copy Markdown

Example: SELECT * FROM "t" WHERE a = $1::jsonb

cast_expr did not accept var_decl as a cast operand, so $1::text failed in function arguments, WHERE clauses, and other expression positions (it only worked at the top column level). Add var_decl to both the bare and parenthesized cast operand lists.

Add round-trip tests for casts on placeholders in function args, WHERE, parenthesized form, and a nested-cast CTE.

cast_expr did not accept var_decl ( / 94104..94104 / @x placeholders) as a cast operand, so  failed in function arguments, WHERE clauses, and other expression positions (it only worked at the top column level). Add var_decl to both the bare and parenthesized cast operand lists.

Add round-trip tests for casts on placeholders in function args, WHERE, parenthesized form, and a nested-cast CTE.
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.

1 participant