sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.59k stars 812 forks source link

Want not to distinguish between table names with backquotes and ones without backquotes. #3550

Open tenkoh opened 3 months ago

tenkoh commented 3 months ago

What do you want to change?

Thank you for an awesome tool!

When I had tried a simple schema and a query for SQLite3, I got relation "users" does not exist" error.

sqlc version: 1.25
CREATE TABLE `users` (
    `id` Integer NOT NULL,
    PRIMARY KEY(`id`)
);
-- name: ListUsers :many
SELECT * FROM users;
{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "sqlite",
    "gen": {
      "go": {
        "out": "db"
      }
    }
  }]
}

playground: https://play.sqlc.dev/p/70a186af745e44d972ae126b78f83a98443a3a70d8bc42462109703baf239ac0

This mismatch resulted in a relation "users" does not exist" error. However, when I removed the backquotes, it worked.

As the example above shows, some SQL tools generate backquoted names, while in some cases, developers do not. Ignoring the difference in backquotes could simplify things. Is this possible?

What database engines need to be changed?

SQLite

What programming language backends need to be changed?

Go