Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: starts endswith for null values #975

Merged
merged 11 commits into from
Jan 15, 2025

Conversation

larslutz96
Copy link
Contributor

@larslutz96 larslutz96 commented Jan 9, 2025

Wrap startswith and endswith with coalesce to return false when element is NULL.

@larslutz96 larslutz96 changed the title fix functions always return true or false fix: functions always return true or false Jan 9, 2025
@larslutz96 larslutz96 marked this pull request as ready for review January 10, 2025 09:02
@larslutz96 larslutz96 changed the title fix: functions always return true or false fix: starts endswith for null values Jan 10, 2025
@@ -75,15 +75,15 @@ const StandardFunctions = {
* @param {string} y
* @returns {string}
*/
startswith: (x, y) => `instr(${x},${y}) = 1`, // sqlite instr is 1 indexed
startswith: (x, y) => `coalesce(instr(${x},${y}) = 1,false)`, // sqlite instr is 1 indexed
Copy link
Member

Choose a reason for hiding this comment

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

this covers only SQLite, is this also relevant for other dbs?:)

Copy link
Contributor Author

@larslutz96 larslutz96 Jan 10, 2025

Choose a reason for hiding this comment

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

added same for postgres. Not relevant for hana

Copy link
Contributor

@David-Kunz David-Kunz left a comment

Choose a reason for hiding this comment

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

👍

@patricebender patricebender enabled auto-merge (squash) January 15, 2025 11:09
@patricebender patricebender merged commit f0330bc into main Jan 15, 2025
3 checks passed
@patricebender patricebender deleted the fix-functions-always-return-true-false branch January 15, 2025 12:11
@cap-bots cap-bots mentioned this pull request Jan 15, 2025
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.

3 participants