Failed to run the following query:
select (date_trunc('hour', my_date) + interval date_part('minute', my_date)::int minutes) as group_by_name from table_name where my_date>= '2023-07-12'
having the following exception:
missing ')' at 'date_part'
what I am missing here
The interval value needs to be a literal, it cannot be an expression, it won't be evaluated.
You might want to truncate "directly" to minutes, in your example.
my example was just part of my query , In order to group by data per 5 minutes, any idea how ?
You can use HISTOGRAM with an INTERVAL 5 MINUTES argument.