Skip to content

Fix filters with intermediate null tag values - #44

Open
tyrasd wants to merge 1 commit into
mainfrom
fix-null-tags
Open

Fix filters with intermediate null tag values#44
tyrasd wants to merge 1 commit into
mainfrom
fix-null-tags

Conversation

@tyrasd

@tyrasd tyrasd commented Jul 30, 2026

Copy link
Copy Markdown
Member

SQL has some "unexpected" behaviour when it comes to handling NULL values, for example the = ANY array comparison results in null if the value it operates on is NULL (instead of false).

If the left-hand expression yields null, the result of ANY is ordinarily null

And when this is combined with the boolean NOT operator, this results in cases where one would expect a true-thy value, but gets NULL instead.

For example, a filter like amenity=bench and NOT (foo in (bar)) will not return features with amenity=bench and no foo tag.

This PR hardens the filter statements which can have intermediate NULL values to include extra is not null checks such that the filters can also be used together with a NOT negation.

TODO:

  • some tests now result in odd assert [<Record count=3936621437>] == [<Record count=765879661>] – not sure what's going on there...

@tyrasd
tyrasd requested a review from matthiasschaub July 30, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant