Skip to content

odata-filter: support yoda notation for null equality#1557

Merged
alxndrsn merged 5 commits intogetodk:masterfrom
alxndrsn:null-is-is-not
Jul 30, 2025
Merged

odata-filter: support yoda notation for null equality#1557
alxndrsn merged 5 commits intogetodk:masterfrom
alxndrsn:null-is-is-not

Conversation

@alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Jul 28, 2025

Previously, this code could generate SQL statements saying NULL IS .... In postgres, this is invalid syntax:

# SELECT (NULL IS '1');
ERROR:  syntax error at or near "'1'"
LINE 1: SELECT (NULL IS '1');

Noted while reviewing #1521

What has been done to verify that this works as intended?

Added new integration tests:

  • for yoda notation
  • for equality in addition to inequality tests

Why is this the best possible solution? Were any other approaches considered?

  • has unit tests (updated existing ones)
  • has integration tests (added new test cases)
  • aims to maximise clarity of test cases by minimising non-relevnat differences between them

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Fixes a bug.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

No.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

alxndrsn added 2 commits July 28, 2025 10:09
Previously, this code could generate SQL statements saying `NULL IS ...`.  In postgres, this is invalid syntax:

	# SELECT (NULL IS '1');
	ERROR:  syntax error at or near "'1'"
	LINE 1: SELECT (NULL IS '1');
@alxndrsn alxndrsn changed the title odata-filter: fix IS NULL SQL syntax odata-filter: support yoda notation for equality Jul 28, 2025
@alxndrsn alxndrsn marked this pull request as ready for review July 28, 2025 10:30
@alxndrsn alxndrsn changed the title odata-filter: support yoda notation for equality odata-filter: support yoda notation for null equality Jul 28, 2025
* check for equality in addition to inequality
* share more code
Copy link
Contributor

@sadiqkhoja sadiqkhoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! looks good to me

Copy link
Contributor

@sadiqkhoja sadiqkhoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

@alxndrsn alxndrsn merged commit 371b95f into getodk:master Jul 30, 2025
6 checks passed
@alxndrsn alxndrsn deleted the null-is-is-not branch July 30, 2025 09:06
@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Sep 17, 2025
@matthew-white matthew-white moved this from 🕒 backlog to ✅ done in ODK Central Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ done

Development

Successfully merging this pull request may close these issues.

2 participants