Skip to content

Trouble getting emit_pointers_for_null_types to apply to SQLite target #3167

Closed

Description

@ddowl

Version

1.24.0

What happened?

I'm having some trouble getting the emit_pointers_for_null_types option to apply to a SQLite schema & queries, i.e. sql.Null* types aren't replaced with their pointer primitive variants. I've checked that other kinds of Go options work correctly, like emit_result_struct_pointers, emit_interface, and emit_json_tags, but not the null type option. I produced a minimal example that reproduces my issue in this playground link. Not sure if this is a SQLite specific issue, since we have a similar Postgres schema where emit_pointers_for_null_types works fine.

Relevant log output

No response

Database schema

CREATE TABLE dummy (
  "id" text NOT NULL PRIMARY KEY,
  "col_1" text
);

SQL queries

-- name: GetDummy :one
SELECT * FROM dummy WHERE id = ?1;

-- name: GetDummies :many
SELECT * FROM dummy;

-- name: CreateDummy :one
INSERT INTO dummy (id, col_1) VALUES (?1, ?2)
RETURNING *;

-- name: UpdateDummy :one
UPDATE dummy SET col_1 = ?2 WHERE id = ?1
RETURNING *;

-- name: DeleteDummy :exec
DELETE FROM dummy WHERE id = ?1;

Configuration

version: "2"
sql:
- schema: "schema.sql"
  queries: "query.sql"
  engine: "sqlite"
  gen:
    go:
      package: "sqlc"
      out: "./"
      emit_pointers_for_null_types: true

Playground URL

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

What operating system are you using?

macOS

What database engines are you using?

SQLite

What type of code are you generating?

Go

Activity

  1. added
    bugSomething isn't working
    triageNew issues that hasn't been reviewed
    on Jan 30, 2024
  2. gregoryjjb commented on Feb 16, 2024

    @gregoryjjb

    This was fixed in 1.25.0 (#3026), your playground example works when I update the version: https://play.sqlc.dev/p/a3eacaca248da3c046efd82fca0056dd995a9a8eac903d5f8eb3117cf14cce84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions