From fd825dde3da2b1f643ded11f0d498c14b7453e45 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 31 Jul 2025 13:46:10 -0400 Subject: [PATCH] fix test --- plugin/filter/templates.go | 4 ++-- store/db/postgres/memo_filter_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin/filter/templates.go b/plugin/filter/templates.go index 82aee38fe..73e1f1df3 100644 --- a/plugin/filter/templates.go +++ b/plugin/filter/templates.go @@ -35,12 +35,12 @@ var SQLTemplates = map[string]SQLTemplate{ "json_contains_element": { SQLite: "JSON_EXTRACT(`memo`.`payload`, '$.tags') LIKE ?", MySQL: "JSON_CONTAINS(JSON_EXTRACT(`memo`.`payload`, '$.tags'), ?)", - PostgreSQL: "memo.payload->'tags' @> jsonb_build_array(?::text)", + PostgreSQL: "memo.payload->'tags' @> jsonb_build_array(?)", }, "json_contains_tag": { SQLite: "JSON_EXTRACT(`memo`.`payload`, '$.tags') LIKE ?", MySQL: "JSON_CONTAINS(JSON_EXTRACT(`memo`.`payload`, '$.tags'), ?)", - PostgreSQL: "memo.payload->'tags' @> jsonb_build_array(?::text)", + PostgreSQL: "memo.payload->'tags' @> jsonb_build_array(?)", }, "boolean_true": { SQLite: "JSON_EXTRACT(`memo`.`payload`, '$.property.hasTaskList') = 1", diff --git a/store/db/postgres/memo_filter_test.go b/store/db/postgres/memo_filter_test.go index 30f2c69e1..05b3abda9 100644 --- a/store/db/postgres/memo_filter_test.go +++ b/store/db/postgres/memo_filter_test.go @@ -17,12 +17,12 @@ func TestConvertExprToSQL(t *testing.T) { }{ { filter: `tag in ["tag1", "tag2"]`, - want: "(memo.payload->'tags' @> jsonb_build_array($1) OR memo.payload->'tags' @> jsonb_build_array($2))", + want: "(memo.payload->'tags' @> jsonb_build_array($1::text) OR memo.payload->'tags' @> jsonb_build_array($2::text))", args: []any{"tag1", "tag2"}, }, { filter: `!(tag in ["tag1", "tag2"])`, - want: "NOT ((memo.payload->'tags' @> jsonb_build_array($1) OR memo.payload->'tags' @> jsonb_build_array($2)))", + want: "NOT ((memo.payload->'tags' @> jsonb_build_array($1::text) OR memo.payload->'tags' @> jsonb_build_array($2::text)))", args: []any{"tag1", "tag2"}, }, { @@ -42,7 +42,7 @@ func TestConvertExprToSQL(t *testing.T) { }, { filter: `tag in ['tag1'] || content.contains('hello')`, - want: "(memo.payload->'tags' @> jsonb_build_array($1) OR memo.content ILIKE $2)", + want: "(memo.payload->'tags' @> jsonb_build_array($1::text) OR memo.content ILIKE $2)", args: []any{"tag1", "%hello%"}, }, { @@ -107,7 +107,7 @@ func TestConvertExprToSQL(t *testing.T) { }, { filter: `"work" in tags`, - want: "memo.payload->'tags' @> jsonb_build_array($1)", + want: "memo.payload->'tags' @> jsonb_build_array($1::text)", args: []any{"work"}, }, {