Skip to content

Nullable time not generated #1225

@alexandre-durand

Description

@alexandre-durand

Version

1.10.0

What happened?

SELECT NULL::time generates time.Time instead of *time.time

Relevant log output

const getAuthor = `-- name: GetAuthor :one
SELECT a.id, NULL::time AS created_at 
FROM authors AS a
WHERE id = $1 LIMIT 1
`

type GetAuthorRow struct {
	ID        int64
	CreatedAt time.Time
}

func (q *Queries) GetAuthor(ctx context.Context, id int64) (GetAuthorRow, error) {
	row := q.db.QueryRowContext(ctx, getAuthor, id)
	var i GetAuthorRow
	err := row.Scan(&i.ID, &i.CreatedAt)
	return i, err
}

Database schema

-- Example queries for sqlc
CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY
);

SQL queries

-- name: GetAuthor :one
SELECT a.*, NULL::time AS created_at 
FROM authors AS a
WHERE id = $1 LIMIT 1;

Configuration

No response

Playground URL

https://play.sqlc.dev/p/3dcd1de298fb749ca0405b8237c1d466b127437f33ad029422d14a5fc02a0298

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

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