agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Resolve untyped parameters in FOR PORTION OF FROM/TO bounds
2+ messages / 1 participants
[nested] [flat]

* pgsql: Resolve untyped parameters in FOR PORTION OF FROM/TO bounds
@ 2026-09-08 08:00  Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2026-09-08 08:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Resolve untyped parameters in FOR PORTION OF FROM/TO bounds

FOR PORTION OF valid_at FROM $1 TO $2 fails with "could not determine data
type of parameter $1", so using PREPARE requires users to say $1::date
etc. But transformForPortionOfClause() already coerces the bounds, since
it builds a constructor for the targeted range. We just need to store the
coerced expressions in targetFrom and targetTo.

This also improves pg_get_ruledef(), which now renders an untyped NULL
bound as NULL::date instead of NULL::unknown.

Reported-by: Noah Misch <noah@leadboat.com>
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/flat/CA%2BrenyW1uJp1dw%3DiK7MsWfbbZf-dKP_4JLoQ65wj%3Dfry35FjCw...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/438f027238c0582e89d4c81e3f88d9b1d6d810d0

Modified Files
--------------
src/backend/parser/analyze.c                 |  12 ++-
src/test/regress/expected/for_portion_of.out | 106 ++++++++++++++++++++++++++-
src/test/regress/sql/for_portion_of.sql      |  71 ++++++++++++++++++
3 files changed, 185 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Resolve untyped parameters in FOR PORTION OF FROM/TO bounds
@ 2026-09-08 08:00  Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2026-09-08 08:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Resolve untyped parameters in FOR PORTION OF FROM/TO bounds

FOR PORTION OF valid_at FROM $1 TO $2 fails with "could not determine data
type of parameter $1", so using PREPARE requires users to say $1::date
etc. But transformForPortionOfClause() already coerces the bounds, since
it builds a constructor for the targeted range. We just need to store the
coerced expressions in targetFrom and targetTo.

This also improves pg_get_ruledef(), which now renders an untyped NULL
bound as NULL::date instead of NULL::unknown.

Reported-by: Noah Misch <noah@leadboat.com>
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/flat/CA%2BrenyW1uJp1dw%3DiK7MsWfbbZf-dKP_4JLoQ65wj%3Dfry35FjCw...

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f1940321687644a3ef38dccca8bbeb7c50d4cbdc

Modified Files
--------------
src/backend/parser/analyze.c                 |  12 ++-
src/test/regress/expected/for_portion_of.out | 106 ++++++++++++++++++++++++++-
src/test/regress/sql/for_portion_of.sql      |  71 ++++++++++++++++++
3 files changed, 185 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-08 08:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 08:00 pgsql: Resolve untyped parameters in FOR PORTION OF FROM/TO bounds Peter Eisentraut <peter@eisentraut.org>
2026-09-08 08:00 pgsql: Resolve untyped parameters in FOR PORTION OF FROM/TO bounds Peter Eisentraut <peter@eisentraut.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox