sqlc
sqlc copied to clipboard
Unquote backticks in sqlite identifiers
Fixes #3350 Fixes #3684 Fixes #3800
In sqlite there is a quirky behavior where backticks are included in table and column names. This causes errors like relation "x" does not exist, even when the column or table is actually present.
The changes in this PR ensure that identifiers no longer include backticks as part of their names.
Steps to reproduce the issues this solves
schema.sql
CREATE TABLE `foo` (`bar` text);
queries.sql
-- name: GetFoo :many
SELECT bar FROM foo;
sqlc.yaml
version: "2"
sql:
- engine: "sqlite"
queries: "queries.sql"
schema: "schema.sql"
gen:
go:
package: "db"
out: "db"
output
> sqlc generate
# package db
queries.sql:1:1: relation "foo" does not exist
@kyleconroy please merge this PR, it's simple but solved a big problem for sqlite users.