Skip to content

add a pggen.optional() directive #85

Open
@breathe

Description

@breathe

It would be nice to be able to explicitly signal when an argument can be null.

I want to be able to explicitly use NULL values to turn off the effect of 'optional' where clauses for some queries

eg:
select 1 as a where (pggen.arg('foo')::bigint is NULL OR pggen.arg('foo')::bigint = a);

But the default inference for this query will infer a non-pointer type for 'foo' above ... It'd be great if I could instead write something like:

select 1 as a where (pggen.optional('foo')::bigint is NULL OR pggen.optional('foo')::bigint = a);

and be given a pointer type so that my go program can pass nil to the query and be certain that the value will be received as NULL by postgres.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions