Last active
September 12, 2018 00:47
-
-
Save joebartels/44808e47cee49762c103e8b691248714 to your computer and use it in GitHub Desktop.
store date fields (day of week, hour, minute) vs. using extract to query postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- returns a random number from within a range (inclusive) | |
create or replace function int_between( | |
in low int, | |
in high int, | |
out int | |
) | |
returns int | |
language sql | |
as $$ | |
select floor(random() * (high - low + 1) + low)::int | |
$$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment