Skip to content

NULLIF returns bool instead of correct type #133

Closed
@kyleconroy

Description

@kyleconroy

Version

1.14.0

What happened?

Actually, NULLIF also smells bad. When using it in a query, the Go struct is generated with a field with a bool type, instead of a NullInt64 type.

Database schema

CREATE TABLE author (
  id bigserial NOT NULL
);

SQL queries

-- name: GetRestrictedId :one
SELECT
  NULLIF(id, $1) restricted_id
FROM
  author;

Configuration

{
  "version": "1",
  "packages": [
    {
      "engine": "postgresql",
      "path": "go",
      "name": "querytest",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/321eb83b945edfab5a41d8c91feb596bcab9860ce1780639d1f9863207a20644

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Originally posted by @euller88 in #92 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions