The given query works perfectly fine when executed with DataGrip, but returns the following error when it's submitted by lib/pq:
pq: a negative number raised to a non-integer power yields a complex result
The error is happening within postgres as it shows up in the logs
SELECT upvotes / (EXTRACT(EPOCH FROM current_timestamp-created_at)/3600)^1.8 as score, title,
FROM ideas
ORDER BY score desc
simplified schema
create table ideas
(
title text not null,
created_at timestamp not null,
upvotes integer default 0 not null
)
I'm running postgres v9.2
I'd be very happy about a little hint in where to look into, as I'm out of ideas.
created_atvalues are in the future.