graphile-contrib/postgraphile-plugin-connection-filter

isNull: true (IS NOT NULL) is not the opposite of isNull: true (IS NULL)

EyMaddis opened this issue · 1 comments

Let me inform you of a small key information I learned about postgres:

https://dba.stackexchange.com/a/157699

I actually do not have a case to reproduce this with this plugin, but noticed it in another postgres context and quickly checked the source code (involving a nullable column with a composite type).
Since you also provide DISTINCT FROM support, I did not dare to PR just yet, but in my humble opinion the default für isNull: false should result in a x IS DISTINCT FROM NULL or NOT (x is NULL).

All of the expressions generated by this plugin operate on the column-level rather than the record-level, so this should not be an issue.

For composite types, we only expose the ability to filter on the columns that make up the composite type, not the composite type itself. Here's the relevant portion of the schema tests:

\\"\\"\\"
A filter to be used against \`Composite\` object types. All fields are combined with a logical ‘and.’
\\"\\"\\"
input CompositeFilter {
\\"\\"\\"Filter by the object’s \`a\` field.\\"\\"\\"
a: IntFilter
\\"\\"\\"Checks for all expressions in this list.\\"\\"\\"
and: [CompositeFilter!]
\\"\\"\\"Filter by the object’s \`b\` field.\\"\\"\\"
b: StringFilter
\\"\\"\\"Negates the expression.\\"\\"\\"
not: CompositeFilter
\\"\\"\\"Checks for any expressions in this list.\\"\\"\\"
or: [CompositeFilter!]
}

If we exposed an isNull there, we might have a problem. I'll try to keep all of this in mind if anyone ever requests that feature.. thanks for bringing it up!