-
Notifications
You must be signed in to change notification settings - Fork 994
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
What do you want to change?
I have the following setup:
queries.sql
-- name: CheckDatabase :exec
SELECT
COUNT(ID),
COUNT(Destination),
COUNT(Hits),
COUNT(Owner)
FROM redirections;schema.sql
CREATE TABLE "redirections" (
"ID" TEXT NOT NULL,
"Destination" TEXT NOT NULL,
"Hits" INTEGER NOT NULL DEFAULT 0,
"Owner" TEXT NOT NULL,
PRIMARY KEY("ID")
);sqlc.json
{
"version": "2",
"sql": [{
"schema": "./internal/datastore/db/schema.sql",
"queries": "./internal/datastore/db/queries.sql",
"engine": "sqlite",
"gen": {
"go": {
"out": "db"
}
}
}]
}I think this should work, and in fact play.sqlc.dev agrees with me there. BUT
$ go run github.com/sqlc-dev/sqlc/cmd/sqlc@latest generate
# package
internal/datastore/db/queries.sql:1:1: relation "redirections" does not exist
exit status 1Thanks to @qbit, I learned about the use of quotations in the CREATE statement leading to all uses of the identifier having to be quoted. Leaving aside how … unideal … this limitation is, I would consider this unexpected behaviour, so I propose one of the following solutions:
- actually parse the name of the identifier (preferred)
- warn the user about this pitfall (if not in the CLI output, then in the docs)
Since I don't think this affects any specific database engine, or language backend, I have not selected any of them. If that's incorrect, I apologise.
What database engines need to be changed?
No response
What programming language backends need to be changed?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request