From f16f5459610822538b986b95c7b0a5ff3a276ff7 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sat, 17 Aug 2024 11:52:53 -0400 Subject: [PATCH] Fix scan error --- pkg/gordio/database/talkgroups.sql.go | 3 ++- pkg/gordio/nexus/commands.go | 2 +- sql/postgres/queries/talkgroups.sql | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/gordio/database/talkgroups.sql.go b/pkg/gordio/database/talkgroups.sql.go index 59b7a7a..be72028 100644 --- a/pkg/gordio/database/talkgroups.sql.go +++ b/pkg/gordio/database/talkgroups.sql.go @@ -94,7 +94,8 @@ WHERE id = systg2id($1, $2) UNION SELECT tgl.id::INT8, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name, -tgl.group_tag, NULL::INTEGER, NULL::JSONB, ARRAY[group_tag], +tgl.group_tag, NULL::INTEGER, NULL::JSONB, +CASE WHEN tgl.group_tag IS NULL THEN NULL ELSE ARRAY[tgl.group_tag] END, TRUE learned FROM talkgroups_learned tgl WHERE system_id = $1 AND tgid = $2 AND ignored IS NOT TRUE diff --git a/pkg/gordio/nexus/commands.go b/pkg/gordio/nexus/commands.go index 9415184..daa9390 100644 --- a/pkg/gordio/nexus/commands.go +++ b/pkg/gordio/nexus/commands.go @@ -45,7 +45,7 @@ func (c *client) Talkgroup(ctx context.Context, tg *pb.Talkgroup) error { db := database.FromCtx(ctx) tgi, err := db.GetTalkgroupWithLearned(ctx, int(tg.System), int(tg.Talkgroup)) if err != nil { - log.Error().Err(err).Int32("sys", tg.System).Int32("tg", tg.Talkgroup).Msg("get tg fail") + log.Error().Err(err).Int32("sys", tg.System).Int32("tg", tg.Talkgroup).Msg("get talkgroup fail") return err } diff --git a/sql/postgres/queries/talkgroups.sql b/sql/postgres/queries/talkgroups.sql index d0261dc..f2ae28d 100644 --- a/sql/postgres/queries/talkgroups.sql +++ b/sql/postgres/queries/talkgroups.sql @@ -38,7 +38,8 @@ WHERE id = systg2id(sqlc.arg(system_id), sqlc.arg(tgid)) UNION SELECT tgl.id::INT8, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name, -tgl.group_tag, NULL::INTEGER, NULL::JSONB, ARRAY[group_tag], +tgl.group_tag, NULL::INTEGER, NULL::JSONB, +CASE WHEN tgl.group_tag IS NULL THEN NULL ELSE ARRAY[tgl.group_tag] END, TRUE learned FROM talkgroups_learned tgl WHERE system_id = sqlc.arg(system_id) AND tgid = sqlc.arg(tgid) AND ignored IS NOT TRUE;