NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Go modules · #160 by repository stars
Last release 20 days ago
13 Sep 2026
Ships fairly regularly
a new release about every 1 weeks
Nearly every release is documented
notes for 13 of 13 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
336 releases · first in 2023
One column per quarter.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Remove references to deprecated --experimental flag
Released 2023-09-06
This is primarily a bugfix release, along with some documentation and testing improvements.
sqlc previously didn't know how to parse a CALL statement when using the MySQL engine,
which meant it was impossible to use sqlc with stored procedures in MySQL databases.
Additionally, sqlc now supports IS [NOT] NULL in queries. And LIMIT and OFFSET clauses
now work with UNION.
GitHub user @orisano continues to bring bugfixes and
improvements to sqlc's SQLite engine. See the "Changes" section below for the
full list.
If you're authoring a sqlc plugin, you can now configure sqlc to pass your plugin the values of specific environment variables.
For example, if your plugin
needs the PATH environment variable, add PATH to the env list in the
plugins collection.
version: '2'
sql:
- schema: schema.sql
queries: query.sql
engine: postgresql
codegen:
- out: gen
plugin: test
plugins:
- name: test
env:
- PATH
wasm:
url: https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm
sha256: 138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790
A variable named SQLC_VERSION is always included in the plugin's
environment, set to the version of the sqlc executable invoking it.
--experimental flag (#2567)UNION ALL (#2613)CAST tests and rearranged postgres tests for same (#2551)Walk (#2660)(v1-20-0)=
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
We've completed our migration to the sqlc-dev/sqlc repository. All existing links and installation instructions will continue to work. If you're using
Released 2023-07-31
kyleconroy/sqlc is now sqlc-dev/sqlcWe've completed our migration to the sqlc-dev/sqlc repository. All existing links and installation instructions will continue to work. If you're using the go tool to install sqlc, you'll need to use the new import path to get v1.20.0 (and all future versions).
# INCORRECT: old import path
go install github.com/kyleconroy/sqlc/cmd/sqlc@v1.20.0
# CORRECT: new import path
go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.20.0
We designed the upgrade process to be as smooth as possible. If you run into any issues, please file a bug report via GitHub.
EXPLAIN ... output in lint rulessqlc vet can now run EXPLAIN on your queries and include the results for use in your lint rules. For example, this rule checks that SELECT queries use an index.
version: 2
sql:
- schema: "query.sql"
queries: "query.sql"
engine: "postgresql"
database:
uri: "postgresql://postgres:postgres@localhost:5432/postgres"
gen:
go:
package: "db"
out: "db"
rules:
- has-index
rules:
- name: has-index
rule: >
query.sql.startsWith("SELECT") &&
!(postgresql.explain.plan.plans.all(p, has(p.index_name) || p.plans.all(p, has(p.index_name))))
The expression environment has two variables containing EXPLAIN ... output, postgresql.explain and mysql.explain. sqlc only populates the variable associated with your configured database engine, and only when you have a database connection configured.
For the postgresql engine, sqlc runs
EXPLAIN (ANALYZE false, VERBOSE, COSTS, SETTINGS, BUFFERS, FORMAT JSON) ...
where "..." is your query string, and parses the output into a PostgreSQLExplain proto message.
For the mysql engine, sqlc runs
EXPLAIN FORMAT=JSON ...
where "..." is your query string, and parses the output into a MySQLExplain proto message.
These proto message definitions are too long to include here, but you can find them in the protos directory within the sqlc source tree.
The output from EXPLAIN ... depends on the structure of your query so it's a bit difficult to offer generic examples. Refer to the PostgreSQL documentation and MySQL documentation for more information.
...
rules:
- name: postgresql-query-too-costly
message: "Query cost estimate is too high"
rule: "postgresql.explain.plan.total_cost > 1.0"
- name: postgresql-no-seq-scan
message: "Query plan results in a sequential scan"
rule: "postgresql.explain.plan.node_type == 'Seq Scan'"
- name: mysql-query-too-costly
message: "Query cost estimate is too high"
rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0"
- name: mysql-must-use-primary-key
message: "Query plan doesn't use primary key"
rule: "has(mysql.explain.query_block.table.key) && mysql.explain.query_block.table.key != 'PRIMARY'"
When building rules that depend on EXPLAIN ... output, it may be helpful to see the actual JSON returned from the database. sqlc will print it When you set the environment variable SQLCDEBUG=dumpexplain=1. Use this environment variable together with a dummy rule to see EXPLAIN ... output for all of your queries.
For any query, you can tell sqlc vet not to evaluate lint rules using the @sqlc-vet-disable query annotation.
/* name: GetAuthor :one */
/* @sqlc-vet-disable */
SELECT * FROM authors
WHERE id = ? LIMIT 1;
Developed by @Jille
MySQL now supports the :copyfrom query annotation. The generated code uses the LOAD DATA command to insert data quickly and efficiently.
Use caution with this feature. Errors and duplicate keys are treated as warnings and insertion will continue, even without an error for some cases. Use this in a transaction and use SHOW WARNINGS to check for any problems and roll back if necessary.
Check the error handling documentation for more information.
CREATE TABLE foo (a text, b integer, c DATETIME, d DATE);
-- name: InsertValues :copyfrom
INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?);
func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) {
...
}
LOAD DATA support must be enabled in the MySQL server.
Developed by @ryanpbrewster and @RadhiFadlillah
sqlc now understands CAST calls in MySQL queries, offering greater flexibility when generating code for complex queries.
CREATE TABLE foo (bar BOOLEAN NOT NULL);
-- name: SelectColumnCast :many
SELECT CAST(bar AS BIGINT) FROM foo;
package querytest
import (
"context"
)
const selectColumnCast = `-- name: SelectColumnCast :many
SELECT CAST(bar AS BIGINT) FROM foo
`
func (q *Queries) SelectColumnCast(ctx context.Context) ([]int64, error) {
...
}
A slew of fixes landed for our SQLite implementation, bringing it closer to parity with MySQL and PostgreSQL. We want to thank @orisano for their continued dedication to improving sqlc's SQLite support.
EXPLAIN ... for queries to the CEL program environment (#2489)@symbol as boolean flags associated with a query (#2464)prepareable() func and a var name (#2509)buf format -w (#2536)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →