Skip to content

Fix DATE_TRUNC with GROUP BY parameter binding#9122

Open
jackfischer wants to merge 2 commits intogeldata:masterfrom
jackfischer:jackfischer/9118
Open

Fix DATE_TRUNC with GROUP BY parameter binding#9122
jackfischer wants to merge 2 commits intogeldata:masterfrom
jackfischer:jackfischer/9118

Conversation

@jackfischer
Copy link
Contributor

Made sure the test was real this time and actually fails and succeeds as expected.

Two issues fixed:

  1. Added 'date_trunc' and 'date_part' to funcs_with_text_args so their text precision argument ('month', 'year', etc.) is correctly typed.

  2. Fixed remap_arguments in pg_ext.pyx to use extra_blobs() instead of variables(). The variables() method returns a deduplicated dict, but when the same literal appears multiple times (e.g., DATE_TRUNC in both SELECT and GROUP BY), we need all occurrences. This matches the pattern used in args_ser.pyx.

Closes #9118

Two issues fixed:

1. Added 'date_trunc' and 'date_part' to funcs_with_text_args so their
   text precision argument ('month', 'year', etc.) is correctly typed.

2. Fixed remap_arguments in pg_ext.pyx to use extra_blobs() instead of
   variables(). The variables() method returns a deduplicated dict, but
   when the same literal appears multiple times (e.g., DATE_TRUNC in both
   SELECT and GROUP BY), we need all occurrences. This matches the pattern
   used in args_ser.pyx.

Closes geldata#9118
... I don't have a checkout on this machine
@msullivan msullivan added the to-backport-7.x PRs that *should* be backported to 7.x label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to-backport-7.x PRs that *should* be backported to 7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL DATE_TRUNC query ExecutionError / FATAL: list index out of range

2 participants