Open
Description
Version
1.27.0
What happened?
WIth Recursive query fails to recognize the relation in SQLite when I run sqlc generate
.
not sure if this works with SQLite, but I tried adding this to config, but it didn't work.
datebase:
managed: true
I'm aware of #723 and #896, and it seems the fix only applies to PostgreSQL + MySQL. But perhaps this bug is more relevant with #2990 even though it happens with MySQL instead.
Relevant log output
# package db
query.sql:1:1: relation "TagWithParents" does not exist
Database schema
CREATE TABLE tags (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
parent INTEGER NOT NULL
);
SQL queries
-- name: GetTagRecursive :many
WITH RECURSIVE TagWithParents AS (
SELECT id, name, parent
FROM tags
WHERE id = ?
UNION ALL
SELECT t.id, t.name, t.parent
FROM tags t
INNER JOIN TagWithParents twp
ON t.id = twp.parent
) SELECT * FROM TagWithParents;
Configuration
version: "2"
sql:
- engine: "sqlite"
queries: "query.sql"
schema: "schema.sql"
gen:
go:
package: "db"
out: "db"
Playground URL
https://play.sqlc.dev/p/bebb509cacaeae9488c4c5c08f9f554d35375fe581dc0c477286ac2bb87a4bcc
What operating system are you using?
Linux
What database engines are you using?
SQLite
What type of code are you generating?
Go