Skip to content

fix(template): cast the update_mask argument to text[] - #85

Merged
iamralch merged 1 commit into
mainfrom
fix/text-array-update-mask
Oct 9, 2026
Merged

iamralch merged 1 commit into
mainfrom
fix/text-array-update-mask

Conversation

@iamralch

@iamralch iamralch commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

The generated UPDATE queries test each column with '<column>' = any(sqlc.arg(update_mask)). sqlc-gen-sqlx, which protoc-contrib/grpc-rust-template uses, can't infer that parameter's type, so grpc-rust-template keeps its own copy of the queries with ::text[] added. That's the only difference between its queries and sqlc-contrib/sqlc-go-template's.

Casting in the template, any(sqlc.arg(update_mask)::text[]) at all 8 places, lets every downstream template use the generated queries unchanged. Go's pgx accepts the cast with a []string argument.

Follow-ups

  • sqlc-go-template: bump this module, regenerate internal/database/query/*.sql and the sqlc code, and run its database suite.
  • grpc-go-template and ogen-go-template: take the regenerated queries. grpc-rust-template's then match them byte for byte.

Test plan

  • go vet ./..., go tool ginkgo -r: all suites pass
  • Downstream: sqlc-go-template's database suite against the regenerated queries (in its follow-up PR)

The UPDATE queries test each column with
'<column>' = any(sqlc.arg(update_mask)). Some sqlc plugins (sqlc-gen-sqlx,
used by grpc-rust-template) cannot infer the parameter's type there and
need the explicit text[] cast; Go's pgx accepts it either way. Casting in
the template lets every downstream template use the generated queries
unchanged instead of patching them.
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Code Metrics Report

Coverage Test Execution Time
84.5% 42s

Reported by octocov

@iamralch iamralch self-assigned this Oct 9, 2026
@iamralch
iamralch merged commit 599606c into main Oct 9, 2026
7 checks passed
@iamralch
iamralch deleted the fix/text-array-update-mask branch October 9, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant