Skip to content

DEFAULT VALUES doesn't work on sqlite #3998

Open
@teepark

Description

@teepark

Version

1.29.0

What happened?

I had a similar issue as #3781 trying to insert DEFAULT VALUES RETURNING id but getting the same failure as in that issue.

To simplify and try to work around it, I removed the RETURNING clause and changed it to :exec, but still got a similar error.

Relevant log output

line 8:22 no viable alternative at input 'workspace default'
# package 
db/queries/auth.sql:1:1: no viable alternative at input 'workspace default'

Database schema

create table workspace(
	id integer primary key autoincrement
);

create table user(
	id integer primary key autoincrement,
	workspace_id integer not null references workspace(id),
	email text not null,
	passhash text
);
create unique index user_by_email on user(email);

SQL queries

-- name: InsertWorkspace :exec
insert into workspace default values;

Configuration

version: "2"
sql:
- schema: db/migrations
  queries: db/queries
  engine: sqlite
  gen:
    go:
      out: db

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

SQLite

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions