Skip to content

Instantly share code, notes, and snippets.

@knoopx
Last active June 5, 2019 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knoopx/5eb3650e1cdae233b19ac450d170fbb2 to your computer and use it in GitHub Desktop.
Save knoopx/5eb3650e1cdae233b19ac450d170fbb2 to your computer and use it in GitHub Desktop.
# generates random dates per row
update myjacoti_measurementsession set date_start = (select random_date() where myjacoti_measurementsession.uuid = myjacoti_measurementsession.uuid);
CREATE OR REPLACE FUNCTION random_date() RETURNS timestamptz AS $$
select NOW() - (trunc(random() * 360) * '1 day'::interval);
$$ LANGUAGE sql STRICT VOLATILE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment