fix(skills): add missing AS alias for COALESCE in embedding search query (#896)

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) <noreply@anthropic.com>
This commit is contained in:
JinwooHyunandClaude Opus 4.6 authored and GitHub committed 2026-04-15 23:00:11 +07:00
1 parent 60ca45ec97
commit a8c01dbc49
1 file changed
+1 -1
+1 -1
View File
@@ -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