Skip to content

incorrect query marshalling the nil []string to null #1908

Open

Description

@thetruechar
create table settings
(
    aspects      jsonb       default '[]'::jsonb,
);
var a []string
Db.Query( &ss, `select * from settings where aspects @> coalesce(?, '[]'::jsonb)`, a)

the query msg will become:

select * from settings where aspects @> coalesce('null', '[]'::jsonb)

not what I expect:

select * from settings where aspects @> coalesce(null, '[]'::jsonb)

only the literal nil work:

var a []string
Db.Query( &ss, `select * from settings where aspects @> coalesce(?, '[]'::jsonb)`, nil)

results:

select * from settings where aspects @> coalesce(null, '[]'::jsonb)

Activity

  1. added a commit that references this issue on Nov 20, 2021
    be3aae4
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions