sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

citext on column resulted to interface{} as type

Open vijaynallagatla opened this issue 3 years ago • 2 comments

Version

Other

What happened?

Version Other

What happened? Hint: I am using v1.13.0 with PostgreSQL DB to generate the Go code.

Looks like the citext column type is resulted to interface{} whereas it should be String or sql.NullString

Result:

type AddNameParams struct {
	Name interface{}
}

Expectation:

type AddNameParams struct {
	Name string
}

Type citext should be supported as a String

Relevant log output

No response

Database schema

CREATE TABLE IF NOT EXISTS temp(id uuid NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(), name citext NOT NULL)

SQL queries

INSERT INTO (name) VALUES('name')

Configuration

No response

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

vijaynallagatla avatar May 02 '22 08:05 vijaynallagatla

Why doesn't this option work as a crutch?

        overrides:
          - db_type: "pg_catalog.citext"
            go_type: "string"

flymedllva avatar Jun 21 '22 19:06 flymedllva

@FlymeDllVa That's what I am using for our production codebase.

However, #1629 should bring it more inline with the Python implementation

ryan-berger avatar Jun 21 '22 20:06 ryan-berger