Skip to content

ppx_pgsql's nullability heuristic has failed for outer joins #4

@NightBlues

Description

@NightBlues

"ppx_pgsql's nullability heuristic has failed" for outer joins
For example if we have 2 tables:

CREATE TABLE authors (id serial PRIMARY KEY, name varchar(255) NOT NULL);
INSERT INTO authors (id, name) VALUES (1, 'John Doe');
CREATE TABLE books (id serial PRIMARY KEY, title varchar(255) NOT NULL, author int NOT NULL REFERENCES authors(id) ON DELETE CASCADE);

Following query will have type string * string instead of string * (string option):

[%sqlf {|
SELECT
 authors.name,
 books.title
FROM authors
LEFT OUTER JOIN books ON books.author = authors.id
|}]

Because books.title is NOT NULL, but author without any book will cause nullability heuristic has failed
May be there is a way to advice nullability for ppx_pgsql?

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