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

NULL inet and json types are not handled #739

Closed
kindermoumoute opened this issue Oct 20, 2020 · 2 comments · Fixed by #1142
Closed

NULL inet and json types are not handled #739

kindermoumoute opened this issue Oct 20, 2020 · 2 comments · Fixed by #1142
Milestone

Comments

@kindermoumoute
Copy link

kindermoumoute commented Oct 20, 2020

Table is created with the following query:

CREATE TABLE example (
    key uuid NOT NULL,
    my_ip inet
);

Generated query will be:

-- name: CreateExample :one
INSERT INTO example (key) VALUES ($1) RETURNING *;

Then when I call the query I got this error when calling CreateExample(ctx, uuid.New()):

sql: Scan error on column index 1, name "my_ip": unsupported Scan, storing driver.Value type <nil> into type *net.IP

EDIT: replace inet with json and the same issue happens. More types might be involved.

@kindermoumoute kindermoumoute changed the title NULL inet types are not handled NULL inet and json types are not handled Oct 20, 2020
@kindermoumoute
Copy link
Author

Looks like we can't just use golang standard types (net.IP, net.HardwareAddr, json.RawMessage...) since they don't properly implement Scan. There are a bunch of opensource driver that already fixed this such as pgtype.

@kyleconroy
Copy link
Collaborator

kyleconroy commented Aug 21, 2021

The net.IP portion of this has been addressed in #1142. The JSON portion is a duplicate of #129. Don't worry though! The JSON side of things will also be fixed in v1.10.0

@kyleconroy kyleconroy added this to the v1.10.0 milestone Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants