Research: sqlc-gen-zombiezen types:many — fixable or workaround? #7
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ginjiruu/toolbelt#7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Question
Is the
sqlc-gen-zombiezentypes:manyIN-clause behavior fixable, or is the ReadAll + Go-filter workaround the answer?WHERE id IN (/* types:many */?)generates a singlestringparam instead of a usable list, so multi-ID IN lookups are broken (go-template inherits the same quirk). The generator issqlc-gen-zombiezen— a third-party codegen plugin. The handoff's workaround isReadAllBoards+ Go-side filtering.Research this: is the generator patchable/forkable (is its source available, does it accept the full list type?), and what would adopting a fork in
tools/'s sqlc tool block cost? Or is the workaround the sanctioned answer and the toolbelt should codify it (helper, docs)?The decision: fix upstream/fork, or make the workaround canonical. Resolve with a
/researchsubagent on a throwawayresearch/<name>branch, then write the plan todocs/plans/.RESOLVED — research complete.
Answer: fixable — via a one-line query annotation, NOT a plugin fork and NOT the workaround.
Key findings:
/* types:many */is not a sqlc annotation — it appears in zero sqlc source files (v1.31.1). sqlc only marks a param as a slice via the documentedsqlc.slice('ids')meta-function, which rewrites to the/*SLICE:ids*/?sentinel the zombiezen plugin already expands.github.com/delaneyj/toolbeltv0.9.1, already installed and latest) has full, correct slice support. Verified end-to-end in a scratch repro:WHERE id IN (sqlc.slice('ids'))→Run(ids []string), placeholder expansion, per-element binding — runtime test passed. Empty slice degrades toIN (NULL)→ 0 rows (friendlier than stock sqlc).go-template/internal/db/queries/expenses.sql:67(ReadExpensesByIdsOrdered). The toolbeltexampleandttrpghave no IN clauses.Decision: use
sqlc.slice('name')for any IN-clause; fix the one consumer query on migration (consumer, out of scope); the ReadAll+filter workaround demotes to a documented fallback for truly dynamic predicates.Separate findings for later tickets:
sqlc-gen-zombiezenis unpinned (resolved from PATH, not in any tool block) — a reproducibility gap; and two genuine but unrelated upstream plugin bugs ({{.Name.Lower}}leaked in error strings; CRUDtime-import, upstream #26).Full findings:
docs/research/sqlc-types-many.mdon branchresearch/sqlc-types-many(commitaad089d).Research resolved: fixable via sqlc.slice() annotation, no fork. Full findings on research/sqlc-types-many branch.