File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,11 +250,15 @@ def _convert_named_params_with_casting(
250250 # Real parameters should not be preceded by a positional parameter like $1, $2, etc.
251251 start_pos = match .start ()
252252 if start_pos > 0 :
253- # Look at the characters before the match
253+ # Look at the characters before the match to see if this is casting syntax
254+ # For casting syntax like $1::UUID, we need to check if preceded by $N:
254255 preceding_text = converted_query [
255- max (0 , start_pos - 3 ) : start_pos
256+ max (0 , start_pos - 4 ) : start_pos
256257 ]
257- # If preceded by $N, this is likely casting syntax, not a parameter
258+ # If preceded by $N: (positional parameter followed by colon), this is casting syntax
259+ if re .search (r"\$\d+:$" , preceding_text ):
260+ continue
261+ # Also check the older pattern for backward compatibility
258262 if re .search (r"\$\d+$" , preceding_text ):
259263 continue
260264 remaining_matches .append (full_match )
You can’t perform that action at this time.
0 commit comments