-
Notifications
You must be signed in to change notification settings - Fork 925
Open
Labels
Description
Version
1.29.0
What happened?
A delete query with a returning and limit clause will fail to compile, despite that it is valid sqlite3.
Furthermore, swapping the returning and limit clause will make the sqlc compilation succeed... However, it's not valid sqlite3 SQL (and it'll fail at runtime).
Maybe it's related to #3188
Relevant log output
sqlc generate -f db/sqlc.yaml
line 2:0 no viable alternative at input 'DELETE'
# package db
queries/thing.sql:1:1: no viable alternative at input 'DELETE'
make: *** [Makefile:10: db/models.go] Error 1
Database schema
CREATE TABLE thing (
id INTEGER PRIMARY KEY,
name TEXT UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);
SQL queries
-- name: DeleteTheThing :one
DELETE FROM thing
WHERE id = ?
RETURNING *
LIMIT 1
;
Configuration
version: "2"
sql:
- engine: "sqlite"
queries: "queries"
schema: "migrations/"
gen:
go:
package: "db"
out: "."
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
SQLite
What type of code are you generating?
Go