Changeset

12723:4cfd09343947

mod_storage_sql: Strip timestamp precision in queries to fix error (thanks muppeth) Fixes Error in SQL transaction: Error executing statement parameters: ERROR: invalid input syntax for integer This was handled for INSERT in 9524bb7f3944 but not SELECT.
author Kim Alvefur <zash@zash.se>
date Wed, 07 Sep 2022 12:27:12 +0200
parents 12722:cd993fd7b60d
children 12725:12ced5db29b2
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Sun Sep 04 10:01:57 2022 +0100
+++ b/plugins/mod_storage_sql.lua	Wed Sep 07 12:27:12 2022 +0200
@@ -355,12 +355,12 @@
 local function archive_where(query, args, where)
 	-- Time range, inclusive
 	if query.start then
-		args[#args+1] = query.start
+		args[#args+1] = math.floor(query.start);
 		where[#where+1] = "\"when\" >= ?"
 	end
 
 	if query["end"] then
-		args[#args+1] = query["end"];
+		args[#args+1] = math.floor(query["end"]);
 		if query.start then
 			where[#where] = "\"when\" BETWEEN ? AND ?" -- is this inclusive?
 		else