changeset 5563:3be1d79ad3a3

Log export: Limit log lines loading to 'sr' imports.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 12 Feb 2022 17:36:20 +0100
parents 5152b4db40cc
children aaa9e658cabd
files pkg/controllers/importqueue.go
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go	Sat Feb 12 09:54:33 2022 +0100
+++ b/pkg/controllers/importqueue.go	Sat Feb 12 17:36:20 2022 +0100
@@ -60,6 +60,7 @@
 FROM import.imports
 WHERE
 `
+	// XXX: Consider not only supporting 'sr' for log message parsing.
 	selectExportSQL = `
 SELECT
   imports.id AS id,
@@ -74,7 +75,9 @@
   EXISTS(SELECT 1 FROM import.import_logs
     WHERE kind = 'warn'::log_type and import_id = id) AS has_warnings,
   data,
-  ARRAY(SELECT msg FROM import.import_logs WHERE import_id = id) AS msgs
+  CASE WHEN kind = 'sr' THEN ARRAY(SELECT msg FROM import.import_logs WHERE import_id = id)
+  ELSE NULL
+  END AS msgs
 FROM import.imports
 WHERE
 `