From a8c01dbc498523e5be23fd95977925b149bf3c3b Mon Sep 17 00:00:00 2001 From: JinwooHyun Date: Thu, 16 Apr 2026 01:00:11 +0900 Subject: [PATCH] fix(skills): add missing AS alias for COALESCE in embedding search query (#896) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SearchByEmbedding query uses COALESCE(description, '') without an AS alias, causing PostgreSQL to name the column 'coalesce'. The sqlx scan struct expects db:"description", so the scan fails with: missing destination name coalesce in *[]pg.skillEmbeddingSearchRow The BackfillEmbeddings query on line 84 already has the correct AS description alias — this fix makes the search query consistent. Co-authored-by: Claude Opus 4.6 (1M context) --- internal/store/pg/skills_embedding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/store/pg/skills_embedding.go b/internal/store/pg/skills_embedding.go index c692b20b..a65caacb 100644 --- a/internal/store/pg/skills_embedding.go +++ b/internal/store/pg/skills_embedding.go @@ -29,7 +29,7 @@ func (s *PGSkillStore) SearchByEmbedding(ctx context.Context, embedding []float3 tenantCond := buildSkillEmbeddingTenantCond(tc) orderN := nextParam limitN := orderN + 1 - q := fmt.Sprintf(`SELECT name, slug, COALESCE(description, ''), version, file_path, + q := fmt.Sprintf(`SELECT name, slug, COALESCE(description, '') AS description, version, file_path, 1 - (embedding <=> $1::vector) AS score FROM skills WHERE status = 'active' AND enabled = true AND embedding IS NOT NULL