Skip to content

Releases: sqlc-dev/sqlc

v1.31.1

22 Apr 14:55
a95e91d

Choose a tag to compare

Bug Fixes

  • Remove go.mod replace directive that breaks go install ...@latest (#4401)
  • Downgrade github.com/ncruces/go-sqlite3 to v0.32.0 (#4400)

Build

  • (deps) Bump github.com/jackc/pgx/v5 (#4398)

v1.31.0

20 Apr 04:27
0f82157

Choose a tag to compare

Bug Fixes

  • Strip psql meta-commands from schema files (#4390)
  • Emit pointers for nullable enum columns when emit_pointers_for_null_types is set (#4388)
  • Map xid8 to pgtype.Uint64 for pgx/v5 (#4387)
  • Rename :one return variable when it conflicts with a parameter (#4383)
  • Coerce SQLite JSONB output regardless of type casing (#4385)
  • Dedupe sqlc.arg parameters wrapped in a type cast for MySQL (#4384)
  • Preserve MySQL optimizer hints in generated query text (#4382)
  • Catch invalid ON CONFLICT DO UPDATE column references (#4366)
  • Replace manual loop with copy() builtin (#4166)
  • (native) Make MySQL connection check immediate on first attempt (#4254)

Documentation

  • Add link to community python plugin (#4157)
  • Add Claude Code remote environment setup instructions (#4246)
  • Add sqlc-gen-sqlx to community language support (#4371)
  • Add GitHub Topic to the plugins page (#4258)

Features

  • (sqlfile) Add sqlfile.Split (#4146)
  • (sqlite) Add database analyzer using ncruces/go-sqlite3 (#4199)
  • (ast) Implement comprehensive SQL AST formatting (#4205)
  • (mysql) Improve AST formatting and add DELETE JOIN support (#4206)
  • (sqlite) Add SQLite support to format tests (#4207)
  • (expander) Add star expander for SELECT * and RETURNING * (PostgreSQL, MySQL, SQLite) (#4203)
  • Add SQLCEXPERIMENT environment variable for experimental features (#4228)
  • Add native database support for e2e tests without Docker (#4236)
  • (postgresql) Add analyzerv2 experiment for database-only analysis (#4237)
  • Graduate parsecmd experiment (#4253)
  • Add parse subcommand with AST JSON output (#4240)
  • Add ClickHouse support to sqlc parse (#4267)
  • Add sqlc-test-setup command for database test environment setup (#4304)

Refactor

  • (ast) Rename Formatter interface to Dialect (#4208)

Build

  • Upgrade Go toolchain to 1.26.2 (#4378)
  • Upgrade Go version to 1.26.0 (#4312)
  • Remove github.com/jackc/pgx/v4 dependency (#4379)
  • Upgrade github.com/pingcap/tidb/pkg/parser (#4389)
  • Install PostgreSQL from theseus-rs/postgresql-binaries instead of apt (#4310)
  • Skip CI/RTD builds when the change is irrelevant (#4381)
  • (deps) 35 dependabot bumps

v1.30.0

01 Sep 23:13
0e3f540

Choose a tag to compare

What's Changed

  • build(deps): bump the production-dependencies group across 1 directory with 2 updates by @dependabot[bot] in #3941
  • build(deps): bump packaging from 24.2 to 25.0 in /docs in the production-dependencies group by @dependabot[bot] in #3940
  • Use MySQL 9 in docker-compose.yml by @vvakame in #3944
  • build(deps): bump golang from 1.24.2 to 1.24.4 by @dependabot[bot] in #3983
  • SQLite: Coerce jsonb columns to json before returning to Go code by @brandur in #3968
  • SQLite: Fix parsing of INSERT DEFAULT VALUES syntax by @kyleconroy in #4010
  • build(deps): bump golang from 1.24.4 to 1.24.5 by @dependabot[bot] in #4014
  • build(deps): bump urllib3 from 2.4.0 to 2.5.0 in /docs by @dependabot[bot] in #3994
  • build(deps): bump the production-dependencies group across 1 directory with 5 updates by @dependabot[bot] in #3989
  • build(deps): bump the production-dependencies group across 1 directory with 4 updates by @dependabot[bot] in #4027
  • build(deps): bump modernc.org/sqlite from 1.38.0 to 1.38.2 in the production-dependencies group by @dependabot[bot] in #4032
  • build(deps): bump the production-dependencies group across 1 directory with 4 updates by @dependabot[bot] in #4018
  • docs: fix parameter syntax inconsistency for MySQL and SQLite by @kotahorii in #4036
  • Fix panic for DELETE with JOIN on subquery by @gwillem in #4023
  • feat(docs): Add link to Gleam/parrot by @kyleconroy in #4038
  • build(deps): bump certifi from 2025.7.14 to 2025.8.3 in /docs in the production-dependencies group by @dependabot[bot] in #4041
  • fix(compiler/mysql): prevent panic in convertSetOprSelectList() by @andrewmbenton in #4042
  • fix: range subselect alias pointer dereference by @ahme-dev in #3711
  • docs: mention pgxpool in go and pgx guide by @seriousben in #4047
  • build(deps): bump google.golang.org/protobuf from 1.36.6 to 1.36.7 in the production-dependencies group by @dependabot[bot] in #4043
  • docs: use correct configuration to generate the given output for JSON type override by @andrewmbenton in #4049
  • docs: clean up and add to docs regarding type overrides by @andrewmbenton in #4060
  • build(deps): bump actions/checkout from 4 to 5 by @dependabot[bot] in #4059
  • chore(engine/dolphin): remove references to deprecated pcast.ChangeStmt by @andrewmbenton in #4057
  • docs: try a different admonition format by @andrewmbenton in #4061
  • docs: use the correct admonition format by @andrewmbenton in #4062
  • fix(codegen/golang): don't omit enums used as arrays by @andrewmbenton in #4058
  • fix(codegen/golang): handle go_struct_tag for db_type overrides by @andrewmbenton in #4055
  • bugfix: Normalize identifier usage for table names by @Mr-Destructive in #4045
  • build(deps): bump the production-dependencies group across 1 directory with 2 updates by @dependabot[bot] in #4071
  • build(deps): bump requests from 2.32.4 to 2.32.5 in /docs in the production-dependencies group by @dependabot[bot] in #4068
  • feat(engine/dolphin): implement MATCH_AGAINST conversion by @wawan93 in #4070
  • docs: add multi-worded table example for renaming by @lukeraphael in #4067
  • build(deps): Upgrade to Go 1.25 by @kyleconroy in #4074
  • build(deps): bump golang from 1.24.5 to 1.25.0 by @dependabot[bot] in #4063
  • test(endtoend): Skip process_plugin_sqlc_gen_json by @kyleconroy in #4075
  • test(endtoend): Use Docker to start database servers by @kyleconroy in #4076
  • build(deps): bump github.com/google/cel-go from 0.26.0 to 0.26.1 in the production-dependencies group by @dependabot[bot] in #4080
  • docs: Add changelog for 1.30.0 by @kyleconroy in #4085
  • feat(cli): Bump version to 1.30.0 by @kyleconroy in #4086

New Contributors

Full Changelog: v1.29.0...v1.30.0

v1.29.0

17 Apr 05:53
aa490d4

Choose a tag to compare

What's Changed

  • new community generator plugin for PHP by @lcarilla in #3813
  • build(deps): bump golang from 1.23.5 to 1.23.6 by @dependabot in #3822
  • build: Use govulncheck action by @alexandear in #3831
  • examples: Add missing Close calls by @alexandear in #3828
  • docs: Fix PostGIS function name by @alexandear in #3829
  • docs: Add Zig plugin by @tinyzimmer in #3824
  • build(deps): bump the production-dependencies group across 1 directory with 3 updates by @dependabot in #3817
  • Add support for json format from process plugins by @rouzier in #3827
  • docs: add link to java plugin by @tandemdude in #3819
  • build(deps): bump the production-dependencies group across 1 directory with 5 updates by @dependabot in #3826
  • Update postgresql_type.go: accept "timestamp" as a case by @theAnuragMishra in #3811
  • build(deps): bump golang from 1.23.6 to 1.24.0 by @dependabot in #3842
  • build(deps): bump myst-parser from 4.0.0 to 4.0.1 in /docs in the production-dependencies group by @dependabot in #3841
  • docs: update supported engines for sqlc-gen-java by @tandemdude in #3843
  • Add sqlite beta support for zig plugin by @tinyzimmer in #3845
  • build(deps): bump modernc.org/sqlite from 1.34.5 to 1.35.0 in the production-dependencies group by @dependabot in #3846
  • update csharp support to stable by @doron050 in #3854
  • build(deps): bump golang from 1.24.0 to 1.24.1 by @dependabot in #3870
  • build(deps): bump jinja2 from 3.1.5 to 3.1.6 in /docs in the production-dependencies group by @dependabot in #3872
  • build: Upgrade to wazero@v1.9.0 by @kyleconroy in #3887
  • build: Upgrade to Go 1.24.1 by @kyleconroy in #3892
  • build: Upgrade to latest version of MySQL parser by @kyleconroy in #3893
  • build(deps): bump pyparsing from 3.2.1 to 3.2.2 in /docs in the production-dependencies group by @dependabot in #3890
  • build(deps): bump golang.org/x/net from 0.33.0 to 0.37.0 by @kyleconroy in #3894
  • build(deps): bump the production-dependencies group across 1 directory with 8 updates by @dependabot in #3896
  • build(deps): bump github.com/jackc/pgx/v5 from 5.7.3 to 5.7.4 in the production-dependencies group by @dependabot in #3898
  • build(deps): bump the production-dependencies group in /docs with 2 updates by @dependabot in #3899
  • build(deps): bump modernc.org/sqlite from 1.36.2 to 1.36.3 in the production-dependencies group by @dependabot in #3905
  • feat(codegen/golang): add an option to wrap query errors that includes query name by @andrewmbenton in #3876
  • fix(pgx): Do not wrap nil error by @kyleconroy in #3913
  • build(deps): bump the production-dependencies group across 1 directory with 2 updates by @dependabot in #3914
  • [typo] locahost → localhost by @alexzamai-orca in #3925
  • build(deps): bump urllib3 from 2.3.0 to 2.4.0 in /docs in the production-dependencies group by @dependabot in #3926
  • build(deps): bump golang from 1.24.1 to 1.24.2 by @dependabot in #3915
  • build(deps): bump the production-dependencies group across 1 directory with 3 updates by @dependabot in #3923
  • fix(migrations): case-sensitive migration rollback detection by @0xSherlokMo in #3919
  • build(deps): Upgrade github.com/wasilibs/go-pgquery by @kyleconroy in #3927
  • build(deps): bump golang.org/x/net from 0.37.0 to 0.38.0 by @dependabot in #3929
  • Add changelog for 1.29.0 by @kyleconroy in #3930
  • feat(cli): Bump version to 1.29.0 by @kyleconroy in #3931

New Contributors

Full Changelog: v1.28.0...v1.29.0

v1.28.0

20 Jan 18:47
349137b

Choose a tag to compare

What's Changed

Fixes

Features

Documentation

Misc

New Contributors

Full Changelog: v1.27.0...v1.28.0

v1.27.0

05 Aug 20:23
fe75dae

Choose a tag to compare

Release notes

Sunsetting hosted ephemeral databases

On September 4th, 2024, we'll be turning off support for hosted ephemeral databases in sqlc Cloud. If you use managed databases or query verification with sqlc Cloud, you'll need to update to 1.27.0 to avoid any issues. I've already emailed you if you're using this feature. It's more than likely that you are not!

#3422

Bug Fixes

  • (dbmanager) Add leading slash to db uri path rewrite (#3493)
  • (verify) Include database engine in request (#3522)

Features

  • (golang) Add initialisms configuration (#3308)
  • (compiler) Support subqueries in the FROM clause (second coming) (#3310)
  • Managed databases with any accessible server (#3421)
  • (vet) Use new dbmanager client (#3423)
  • (verify) Update verify to work with managed databases (#3425)

Documentation

  • Fix typo in config (#3358)
  • Resolve a typo in configuration keys (#3349)
  • Add sponsorship information to README (#3413)
  • Update the language-support to include C# (#3408)
  • Add migration guide for hosted managed databases (#3417)
  • Fix readme links (#3424)
  • Update the managed db and verify documentation (#3426)
  • Add sponsor image (#3428)
  • Add Ruby as supported language (#3487)
  • Update migrating-to-sqlc-gen-kotlin.md (#3454)
  • Fix typo in comment (#3316)
  • Fix deprecated build tag format (#3361)

Testing

  • (endtoend) Re-use databases when possible (#3315)
  • Enabled MySQL database (#3318)
  • Remove internal/sqltest/hosted package (#3521)

v1.26.0

28 Mar 20:48
25b942f

Choose a tag to compare

Release notes

This release is mainly a bug fix release. It also includes an important security fix for users using output plugins.

Changes

Bug Fixes

  • (docker) Use distroless base image instead of scratch (#3111)
  • (generate) Ensure files are created inside output directory (#3195)
  • (mysql) BREAKING: Use int16 for MySQL SMALLINT and YEAR (#3106)
  • (mysql) BREAKING: Use int8 for MySQL TINYINT (#3298)
  • (mysql) Variables not resolving in ORDER BY statements (#3115)
  • (opts) Validate SQL package and driver options (#3241)
  • (postgres/batch) Ignore query_parameter_limit for batches
  • (scripts) Remove deprecated test output regeneration script (#3105)
  • (sqlite) Correctly skip unknown statements (#3239)

Documentation

  • (postgres) Add instructions for PostGIS/GEOS (#3182)
  • Improve details on TEXT (#3247)

Features

  • (generate) Avoid generating empty Go imports (#3135)
  • (mysql) Add NEXTVAL() to the MySQL catalog (#3147)
  • (mysql) Support json.RawMessage for LOAD DATA INFILE (#3099)

Build

  • (deps) Bump github.com/jackc/pgx/v5 to 5.5.5 (#3259)
  • (deps) Bump modernc.org/sqlite to 1.29.5 (#3200)
  • (deps) Bump github.com/go-sql-driver/mysql to 1.8.0 (#3257)
  • (deps) Bump github.com/tetratelabs/wazero to 1.7.0 (#3096)
  • (deps) Bump github.com/pganalyze/pg_query_go to v5 (#3096)

v1.25.0

04 Jan 00:26
2b73120

Choose a tag to compare

What's new

Add tags to push and verify

You can add tags when pushing schema and queries to sqlc Cloud. Tags operate like git tags, meaning you can overwrite previously-pushed tag values. We suggest tagging pushes to associate them with something relevant from your environment, e.g. a git tag or branch name.

$ sqlc push --tag v1.0.0

Once you've created a tag, you can refer to it when verifying changes, allowing you
to compare the existing schema against a known set of previous queries.

$ sqlc verify --against v1.0.0

C-ya, cgo

Over the last month, we've switched out a few different modules to remove our reliance on cgo. Previously, we needed cgo for three separate functions:

With the help of the community, we found cgo-free alternatives for each module:

For the first time, Windows users can enjoy full PostgreSQL support without using WSL. It's a Christmas miracle!

If you run into any issues with the updated dependencies, please open an issue.

Bug Fixes

  • (codegen) Wrong yaml annotation in go codegen options for output_querier_file_name (#3006)
  • (codegen) Use derived ArrayDims instead of deprecated attndims (#3032)
  • (codegen) Take the maximum array dimensions (#3034)
  • (compiler) Skip analysis of queries without a name annotation (#3072)
  • (codegen/golang) Don't import "strings" for sqlc.slice() with pgx (#3073)

Documentation

  • Add name to query set configuration (#3011)
  • Add a sidebar link for push, add Go plugin link (#3023)
  • Update banner for sqlc-gen-typescript (#3036)
  • Add strict_order_by in doc (#3044)
  • Re-order the migration tools list (#3064)

Features

  • (analyzer) Return zero values when encountering unexpected ast nodes (#3069)
  • (codegen/go) add omit_sqlc_version to Go code generation (#3019)
  • (codgen/go) Add emit_sql_as_comment option to Go code plugin (#2735)
  • (plugins) Use wazero instead of wasmtime (#3042)
  • (push) Add tag support (#3074)
  • (sqlite) Support emit_pointers_for_null_types (#3026)

Testing

  • (endtoend) Enable for more build targets (#3041)
  • (endtoend) Run MySQL and PostgreSQL locally on the runner (#3095)
  • (typescript) Test against sqlc-gen-typescript (#3046)
  • Add tests for omit_sqlc_version (#3020)
  • Split schema and query for test (#3094)

Build

  • (deps) Bump idna from 3.4 to 3.6 in /docs (#3010)
  • (deps) Bump sphinx-rtd-theme from 1.3.0 to 2.0.0 in /docs (#3016)
  • (deps) Bump golang from 1.21.4 to 1.21.5 (#3043)
  • (deps) Bump actions/setup-go from 4 to 5 (#3047)
  • (deps) Bump github.com/jackc/pgx/v5 from 5.5.0 to 5.5.1 (#3050)
  • (deps) Upgrade to latest version of github.com/wasilibs/go-pgquery (#3052)
  • (deps) Bump google.golang.org/grpc from 1.59.0 to 1.60.0 (#3053)
  • (deps) Bump babel from 2.13.1 to 2.14.0 in /docs (#3055)
  • (deps) Bump actions/upload-artifact from 3 to 4 (#3061)
  • (deps) Bump modernc.org/sqlite from 1.27.0 to 1.28.0 (#3062)
  • (deps) Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#3068)
  • (deps) Bump google.golang.org/grpc from 1.60.0 to 1.60.1 (#3070)
  • (deps) Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 (#3079)
  • (deps) Bump github.com/tetratelabs/wazero from 1.5.0 to 1.6.0 (#3096)
  • (sqlite) Update to antlr 4.13.1 (#3086)
  • (sqlite) Disable modernc for WASM (#3048)
  • (sqlite) Switch from mattn/go-sqlite3 to modernc.org/sqlite (#3040)

New Contributors

Full Changelog: v1.24.0...v1.25.0

v1.24.0

22 Nov 18:11

Choose a tag to compare

What's new

Verifying database schema changes

Schema updates and poorly-written queries often bring down production databases. That’s bad.

Out of the box, sqlc generate catches some of these issues. Running sqlc vet with the sqlc/db-prepare rule catches more subtle problems. But there is a large class of issues that sqlc can’t prevent by looking at current schema and queries alone.

For instance, when a schema change is proposed, existing queries and code running in production might fail when the schema change is applied. Enter sqlc verify, which analyzes existing queries against new schema changes and errors if there are any issues.

Let's look at an example. Assume you have these two tables in production.

CREATE TABLE users (
  id UUID PRIMARY KEY
);

CREATE TABLE user_actions (
  id UUID PRIMARY KEY,
  user_id UUID NOT NULL,
  action TEXT,
  created_at TIMESTAMP
);

Your application contains the following query to join user actions against the users table.

-- name: GetUserActions :many
SELECT * FROM users u
JOIN user_actions ua ON u.id = ua.user_id
ORDER BY created_at;

So far, so good. Then assume you propose this schema change:

ALTER TABLE users ADD COLUMN created_at TIMESTAMP;

Running sqlc generate fails with this change, returning a column reference "created_at" is ambiguous error. You update your query to fix the issue.

-- name: GetUserActions :many
SELECT * FROM users u
JOIN user_actions ua ON u.id = ua.user_id
ORDER BY u.created_at;

While that change fixes the issue, there's a production outage waiting to happen. When the schema change is applied, the existing GetUserActions query will begin to fail. The correct way to fix this is to deploy the updated query before applying the schema migration.

It ensures migrations are safe to deploy by sending your current schema and queries to sqlc cloud. There, we run the queries for your latest push against your new schema changes. This check catches backwards incompatible schema changes for existing queries.

Here sqlc verify alerts you to the fact that ORDER BY "created_at" is ambiguous.

$ sqlc verify
FAIL: app query.sql

=== Failed
=== FAIL: app query.sql GetUserActions
    ERROR: column reference "created_at" is ambiguous (SQLSTATE 42702)

By the way, this scenario isn't made up! It happened to us a few weeks ago. We've been happily testing early versions of verify for the last two weeks and haven't had any issues since.

This type of verification is only the start. If your application is deployed on-prem by your customers, verify could tell you if it's safe for your customers to rollback to an older version of your app, even after schema migrations have been run.

Rename upload command to push

We've renamed the upload sub-command to push. We changed the data sent along in a push request. Upload used to include the configuration file, migrations, queries, and all generated code. Push drops the generated code in favor of including the plugin.GenerateRequest, which is the protocol buffer message we pass to codegen plugins.

We also add annotations to each push. By default, we include these environment variables if they are present:

GITHUB_REPOSITORY
GITHUB_REF
GITHUB_REF_NAME
GITHUB_REF_TYPE
GITHUB_SHA

Like upload, push should be run when you tag a release of your application. We run it on every push to main, as we continuously deploy those commits.

MySQL support in createdb

The createdb command, added in the last release, now supports MySQL. If you have a cloud project configured, you can use sqlc createdb to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the managed databases documentation.

Plugin interface refactor

This release includes a refactored plugin interface to better support future functionality. Plugins now support different methods via a gRPC service interface, allowing plugins to support different functionality in a backwards-compatible way.

By using gRPC interfaces, we can even (theoretically) support remote plugins, but that's something for another day.

New Contributors

Full Changelog: v1.23.0...v1.24.0

v1.23.0

24 Oct 19:48

Choose a tag to compare

What's new

Database-backed query analysis

With a database connection configured, sqlc generate will gather metadata from that database to support its query analysis. Turning this on resolves a large number of issues in the backlog related to type inference and more complex queries. The easiest way to try it out is with managed databases.

The database-backed analyzer currently supports PostgreSQL, with MySQL and SQLite support planned in the future.

New createdb command

When you have a cloud project configured, you can use the new sqlc createdb command to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the managed databases documentation.

Support for pgvector

If you're using pgvector, say goodbye to custom overrides! sqlc now generates code using pgvector-go as long as you're using pgx. The pgvector extension is also available in managed databases.

Go build tags

With the new emit_build_tags configuration parameter you can set build tags for sqlc to add at the top of generated source files.

What's Changed

New Contributors

Read more