Skip to content

sqlite generate error #4648

Closed as duplicate
Closed as duplicate

Description

@piyongcai-liucai

Version

1.31.1

What happened?

CREATE TABLE IF NOT EXISTS id3_meta_times (
    day   TEXT      NOT NULL,
    times INT       NOT NULL,
    CONSTRAINT "pk:id3_meta_times" PRIMARY KEY(day)
);

-- name: UpdateId3MetaTimes :exec
INSERT INTO id3_meta_times
      (                   day, times)
VALUES(strftime('%Y%d','now'),     1)
ON CONFLICT(day)
DO UPDATE SET times = times + 1;

generate error code

// - ON CONFLICT(day) DO UPDATE SET tim     - > MISSING ENDING 
const updateId3MetaTimes = `-- name: UpdateId3MetaTimes :exec
INSERT INTO id3_meta_times
      (                   day, times)
VALUES(strftime('%Y%d','now'),     1)
ON CONFLICT(day)
DO UPDATE SET tim
`

//
//	INSERT INTO id3_meta_times
//	      (                   day, times)
//	VALUES(strftime('%Y%d','now'),     1)
//	ON CONFLICT(day)
//	DO UPDATE SET tim                     <- HERE
func (q *Queries) UpdateId3MetaTimes(ctx context.Context) error {
	_, err := q.db.ExecContext(ctx, updateId3MetaTimes)
	return err
}

Relevant log output

Database schema

SQL queries

Configuration

Playground URL

No response

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

Activity

  1. kyleconroy commented on Oct 19, 2026

    @kyleconroy
    Collaborator

    This was fixed in github.com//pull/4535, which will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions