Skip to content

emit_pointers_for_null_types not working with postgres in v1.25.0 #3221

@Ezward

Description

@Ezward

Version

1.25.0

What happened?

Adding the "emit_pointers_for_null_types": true to the "version": "2" sqlc.json in the playground does not result in *string fields; they remain sql.NullString fields. This is the sqlc-version.txt contents

v1.25.0

This is the models.sql that is output:

// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.25.0

package db

import (
	"database/sql"
)

type Author struct {
	ID   int64
	Name string
	Bio  sql.NullString
}

Relevant log output

No response

Database schema

CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY,
  name text      NOT NULL,
  bio  text
);

SQL queries

-- name: GetAuthor :one
SELECT * FROM authors
WHERE id = $1 LIMIT 1;

-- name: ListAuthors :many
SELECT * FROM authors
ORDER BY name;

-- name: CreateAuthor :one
INSERT INTO authors (
  name, bio
) VALUES (
  $1, $2
)
RETURNING *;

-- name: DeleteAuthor :exec
DELETE FROM authors
WHERE id = $1;

Configuration

{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "postgresql",
    "gen": {
      "go": {
        "out": "db",
        "emit_pointers_for_null_types": true
      }
    }
  }]
}

Playground URL

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

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

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