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

Parsing failure with parenthesis in WHERE clause #10

Open
elv-gilles opened this issue Jun 20, 2023 · 0 comments
Open

Parsing failure with parenthesis in WHERE clause #10

elv-gilles opened this issue Jun 20, 2023 · 0 comments

Comments

@elv-gilles
Copy link

The following update statement produces an error, although legal in sqlite3:

    update_test.go:33: failed: 8:8: expected semicolon or EOF, found ndx

code

func TestUpdate(t *testing.T) {
	s := `UPDATE asynq_tasks
SET state='active',
    pending_since=NULL,
    affinity_timeout=server_affinity,
    deadline=iif(task_deadline=0, task_timeout+1687276020, task_deadline)    
WHERE asynq_tasks.state='pending'
  AND (task_uuid,
       ndx,
       pndx,
       task_msg,
       task_timeout,
       task_deadline)=
    (SELECT task_uuid,
            ndx,
            pndx,
            task_msg,
            task_timeout,
            task_deadline
     FROM asynq_tasks)
`
	stmt, err := sql.NewParser(strings.NewReader(s)).ParseStatement()
	if err != nil {
		t.Fatalf("failed: %v", err)
	}
	_, ok := stmt.(*sql.UpdateStatement)
	if !ok {
		t.Fatalf("failed: expected UpdateStatement")
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant