Skip to main content
Changed function `tsrange` to `tstzrange` to match my timestamp column type. Added a missing closing ' on the brackets parameter in `tstzrange()`.
Source Link

Make your function return a tsrangetstzrange then you can use something like this:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ get_time_limits()

I haven't tried, but the following should work using the current function:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ (select tsrangetstzrange(min_time, max_time, '[]'[]') from get_time_limits()) 

Make your function return a tsrange then you can use something like this:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ get_time_limits()

I haven't tried, but the following should work using the current function:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ (select tsrange(min_time, max_time, '[]) from get_time_limits()) 

Make your function return a tstzrange then you can use something like this:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ get_time_limits()

I haven't tried, but the following should work using the current function:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ (select tstzrange(min_time, max_time, '[]') from get_time_limits()) 
Source Link
user1822
user1822

Make your function return a tsrange then you can use something like this:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ get_time_limits()

I haven't tried, but the following should work using the current function:

SELECT timestamp, col 
FROM data
WHERE timestamp <@ (select tsrange(min_time, max_time, '[]) from get_time_limits())