Fix scan error

This commit is contained in:
Daniel 2024-08-17 11:52:53 -04:00
parent 12138ab6eb
commit f16f545961
3 changed files with 5 additions and 3 deletions

View file

@ -94,7 +94,8 @@ WHERE id = systg2id($1, $2)
UNION UNION
SELECT SELECT
tgl.id::INT8, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name, 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 TRUE learned
FROM talkgroups_learned tgl FROM talkgroups_learned tgl
WHERE system_id = $1 AND tgid = $2 AND ignored IS NOT TRUE WHERE system_id = $1 AND tgid = $2 AND ignored IS NOT TRUE

View file

@ -45,7 +45,7 @@ func (c *client) Talkgroup(ctx context.Context, tg *pb.Talkgroup) error {
db := database.FromCtx(ctx) db := database.FromCtx(ctx)
tgi, err := db.GetTalkgroupWithLearned(ctx, int(tg.System), int(tg.Talkgroup)) tgi, err := db.GetTalkgroupWithLearned(ctx, int(tg.System), int(tg.Talkgroup))
if err != nil { 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 return err
} }

View file

@ -38,7 +38,8 @@ WHERE id = systg2id(sqlc.arg(system_id), sqlc.arg(tgid))
UNION UNION
SELECT SELECT
tgl.id::INT8, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name, 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 TRUE learned
FROM talkgroups_learned tgl FROM talkgroups_learned tgl
WHERE system_id = sqlc.arg(system_id) AND tgid = sqlc.arg(tgid) AND ignored IS NOT TRUE; WHERE system_id = sqlc.arg(system_id) AND tgid = sqlc.arg(tgid) AND ignored IS NOT TRUE;