Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using type overrides with pointer true import are missing #2168

Closed
ludusrusso opened this issue Mar 27, 2023 · 1 comment · Fixed by #2217
Closed

When using type overrides with pointer true import are missing #2168

ludusrusso opened this issue Mar 27, 2023 · 1 comment · Fixed by #2217
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@ludusrusso
Copy link
Contributor

ludusrusso commented Mar 27, 2023

Version

1.17.2

What happened?

In version 1.17.x, when using type overrides with something like that:

"go_type": {
          "import": "test",
		  "type": "Test",
		  "package": "t",
		  "pointer": true // <- here is the problem
        }

The output does not contain the import

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

package db

// missing import
import ()

type Author struct {
	ID   int64
	Name string
	Test *t.Test
}

Note: It works if I remove pointer: true

Relevant log output

N/A

Database schema

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

SQL queries

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

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql",
	  "overrides": [
	  {
	  	"column": "authors.test",
		"go_type": {
          "import": "test",
		  "type": "Test",
		  "package": "t",
		  "pointer": true
        }
	  }
	  ]
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/0e968f5100c6326cf6a4b10baf3d45db7ebe0997f09d7bf03f2897f5e2553966

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

@ludusrusso ludusrusso added bug Something isn't working triage New issues that hasn't been reviewed labels Mar 27, 2023
@balogal
Copy link

balogal commented Mar 29, 2023

Looks like it is the same issue reported by @vmalyavin in #2125. I'm facing it as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that hasn't been reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants