You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Howdy, I've really enjoyed using this software so far. Thank you for writing it! I think I found a problem in SQLite, and I think I have a vague understanding of the cause.
When I write a test like this on top of the latest main:
diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/catalog.sql b/internal/endtoend/testdata/sqlc_arg/sqlite/catalog.sql
new file mode 100644
index 00000000..2d02dc78
--- /dev/null+++ b/internal/endtoend/testdata/sqlc_arg/sqlite/catalog.sql@@ -0,0 +1 @@+CREATE TABLE t (a INTEGER);diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql b/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql
new file mode 100644
index 00000000..386bf906
--- /dev/null+++ b/internal/endtoend/testdata/sqlc_arg/sqlite/query.sql@@ -0,0 +1,5 @@+-- name: FuncParamIdent :many+SELECT a FROM t WHERE a = sqlc.arg(b);++-- name: FuncParamString :many+SELECT a FROM t WHERE a = sqlc.arg('b');diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.yaml b/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.yaml
new file mode 100644
index 00000000..f16dc833
--- /dev/null+++ b/internal/endtoend/testdata/sqlc_arg/sqlite/sqlc.yaml@@ -0,0 +1,8 @@+version: "2"+sql:+- schema: catalog.sql+ queries: query.sql+ engine: sqlite+ gen:+ go:+ out: db--
2.37.1
I believe this error comes from ./internal/engine/sqlite.Parser.Parse(), which make sense. SQLite doesn't have namespaces, so it cannot parse sqlc.arg(ident). It can parse sqlc_arg(ident), but then of course the rewrite rule doesn't do its job.
What should we do? Perhaps move the rewriting before the engine parse step? Or extend the syntax of named parameters? I'm more than happy to write some code, ask more questions, or hear more opinions.
Version
Other
What happened?
Howdy, I've really enjoyed using this software so far. Thank you for writing it! I think I found a problem in SQLite, and I think I have a vague understanding of the cause.
When I write a test like this on top of the latest main:
I get an error like this:
I believe this error comes from ./internal/engine/sqlite.Parser.Parse(), which make sense. SQLite doesn't have namespaces, so it cannot parse
sqlc.arg(ident)
. It can parsesqlc_arg(ident)
, but then of course the rewrite rule doesn't do its job.What should we do? Perhaps move the rewriting before the engine parse step? Or extend the syntax of named parameters? I'm more than happy to write some code, ask more questions, or hear more opinions.
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/cb336b688e15e85a40b86bcda950315188279233546f4e0e3996cf7dfc84b315
What operating system are you using?
macOS
What database engines are you using?
No response
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: