Skip to content

No parameter gets generated for CASE ? WHEN... #2847

Closed
@chowey

Description

@chowey

Version

1.22.0

What happened?

I use a CASE statement of the form CASE ? WHEN true THEN '1' WHEN false THEN '0' ELSE NULL END.

The generated Go function has no parameters for the ?.

Relevant log output

No response

Database schema

CREATE TABLE testing (
  id    int PRIMARY KEY,
  value text
);

SQL queries

UPDATE testing
SET value = CASE ? WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "mysql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/c6a70bea34b4e836d2cc998f885ae6c51d2234632ebe9de53865c23a68588dc6

What operating system are you using?

macOS

What database engines are you using?

MySQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions