From 4f5cce33fc78f05be0fa539e9c6e14e43333a5b7 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Wed, 9 Mar 2022 21:21:01 +0100 Subject: [PATCH] Add comments to database functions --- .../upgrade11-v0.2.1-tstamp-functions.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/etc/db/upgrades/upgrade11-v0.2.1-tstamp-functions.sql b/etc/db/upgrades/upgrade11-v0.2.1-tstamp-functions.sql index cee0bd4..28c14e2 100644 --- a/etc/db/upgrades/upgrade11-v0.2.1-tstamp-functions.sql +++ b/etc/db/upgrades/upgrade11-v0.2.1-tstamp-functions.sql @@ -68,6 +68,12 @@ BEGIN SELECT tstamp FROM raw_shots WHERE sequence = s AND point = p LIMIT 1; $inner$ LANGUAGE SQL; + + COMMENT ON FUNCTION tstamp_from_sequence_shot(numeric, numeric) + IS 'Get the timestamp of an existing shotpoint.'; + + + END; $$ LANGUAGE plpgsql; @@ -97,6 +103,13 @@ BEGIN $inner$ LANGUAGE SQL; + COMMENT ON FUNCTION public.sequence_shot_from_tstamp(timestamptz, numeric) + IS 'Get sequence and shotpoint from timestamp. + +Given a timestamp this function returns the closest shot to it within the given tolerance value. + +This uses the `real_time_inputs` table and it does not give an indication of which project the shotpoint belongs to. It is assumed that a single project is being acquired at a given time.'; + CREATE OR REPLACE FUNCTION public.sequence_shot_from_tstamp( IN ts timestamptz, OUT "sequence" numeric, @@ -106,6 +119,10 @@ BEGIN SELECT * FROM public.sequence_shot_from_tstamp(ts, 3); $inner$ LANGUAGE SQL; + COMMENT ON FUNCTION public.sequence_shot_from_tstamp(timestamptz) + IS 'Get sequence and shotpoint from timestamp. + +Overloaded form in which the tolerance value is implied and defaults to three seconds.'; FOR row IN SELECT schema_name FROM information_schema.schemata