Re: BUG #17176: Error raised on valid query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: peter(dot)davie(at)convergentsolutions(dot)com(dot)au
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17176: Error raised on valid query
Date: 2021-09-02 18:52:55
Message-ID: 2264177.1630608775@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> Hibernate is generating the following query:

> select distinct date_part('year', internalme0_.when_occurred) as col_0_0_,
> date_part('month', internalme0_.when_occurred) as col_1_0_, date_part('day',
> internalme0_.when_occurred) as col_2_0_, date_part('hour',
> internalme0_.when_occurred) as col_3_0_, date_part('minute',
> internalme0_.when_occurred) as col_4_0_
> from InternalMessages internalme0_
> group by date_part('year', internalme0_.when_occurred) , date_part('month',
> internalme0_.when_occurred) , date_part('day', internalme0_.when_occurred) ,
> date_part('hour', internalme0_.when_occurred) , date_part('minute',
> internalme0_.when_occurred) , internalme0_.when_occurred
> order by date_part($1, internalme0_.when_occurred) asc, date_part($2,
> internalme0_.when_occurred) asc, date_part($3, internalme0_.when_occurred)
> asc, date_part($4, internalme0_.when_occurred) asc, date_part($5,
> internalme0_.when_occurred) asc

> The placeholders contain the values 'year', 'month', 'day', 'hour' and
> 'minute'.

Doesn't matter. Those expressions are not semantically equivalent,
and your assertion of that doesn't make it so. The query has to be
valid for any values of the placeholders.

(If you'd like to substitute specific parameter values in advance of
semantic analysis, then do it on the client side.)

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-09-02 21:28:04 Re: BUG #17172: NaN compare error in hash agg
Previous Message PG Bug reporting form 2021-09-02 10:54:03 BUG #17176: Error raised on valid query