Re: BUG #17176: Error raised on valid query - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17176: Error raised on valid query
Date
Msg-id 2264177.1630608775@sss.pgh.pa.us
Whole thread Raw
In response to BUG #17176: Error raised on valid query  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17176: Error raised on valid query
Next
From: Tom Lane
Date:
Subject: Re: BUG #17172: NaN compare error in hash agg