Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sqlc cannot compile valid delete returning limit statement for sqlite3 #4066

Open
@AdrienHorgnies

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /