Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RETURNING doesn't work when inserting default values. #3781

Open
2LeoCode opened this issue Jan 12, 2025 · 0 comments
Open

RETURNING doesn't work when inserting default values. #3781

2LeoCode opened this issue Jan 12, 2025 · 0 comments
Labels
📚 sqlite bug Something isn't working 💻 linux

Comments

@2LeoCode
Copy link

Version

1.27.0

What happened?

A bug happened!

Relevant log output

sql/queries/discussion.sql:1:1: extraneous input 'RETURNING' expecting {<EOF>, ';', ALTER_, ANALYZE_, ATTACH_, BEGIN_, COMMIT_, CREATE_, DEFAULT_, DELETE_, DETACH_, DROP_, END_, EXPLAIN_, INSERT_, PRAGMA_, REINDEX_, RELEASE_, REPLACE_, ROLLBACK_, SAVEPOINT_, SELECT_, UPDATE_, VACUUM_, VALUES_, WITH_}

Database schema

CREATE TABLE IF NOT EXISTS discussion (
  id INTEGER PRIMARY KEY,
  creation_time INTEGER NOT NULL DEFAULT (unixepoch())
);

SQL queries

-- name: Discussion_Create :one
INSERT INTO discussion DEFAULT VALUES RETURNING id;

Configuration

{
  "version": "2",
  "sql": [{
    "engine": "sqlite",
    "schema": "sql/schema",
    "queries": "sql/queries",
    "gen": {
      "go": {
        "out": "go/database/sqlc",
        "emit_pointers_for_null_types": true
      },
      "json": {
        "out": "go/database"
      }
    }
  }]
}

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

@2LeoCode 2LeoCode added the bug Something isn't working label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 sqlite bug Something isn't working 💻 linux
Projects
None yet
Development

No branches or pull requests

1 participant