commit 2274caea40f41a3d31a0394feb69ae0ac11771a0
parent 068a7ed91ddddd4f1f715941ff017514861a5cd6
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 6 Aug 2026 22:47:25 +0200
fix SQL type issues
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/exchangedb/sql-schema/tops-0001.sql b/src/exchangedb/sql-schema/tops-0001.sql
@@ -95,7 +95,13 @@ DECLARE
my_investigate_property JSONB;
my_measure_name TEXT;
my_rules TEXT;
+ my_now INT8;
BEGIN
+ -- legitimization_outcomes.decision_time and .expiration_time are stored in
+ -- microseconds (that is what GNUNET_PQ_query_param_timestamp() writes), so
+ -- the durations below have to be scaled accordingly.
+ my_now = ROUND(EXTRACT(epoch FROM CURRENT_TIMESTAMP(0)::TIMESTAMP))::INT8
+ * 1000000;
SELECT wt.h_normalized_payto
INTO my_h_payto
FROM wire_targets wt
@@ -202,12 +208,12 @@ BEGIN
) VALUES (
my_h_payto
,my_now
- ,my_now + 366*24*60*60
- ,my_properties
+ ,my_now + 366*24*60*60*1000000::INT8
+ ,my_properties::JSONB
,my_measure_name
,TRUE
,TRUE
- ,my_rules);
+ ,my_rules::JSONB);
END IF;
END IF;
END IF;