Add cxjs_nullif() - #131
Conversation
Greptile SummaryThis PR adds client-side support for
Confidence Score: 4/5The null second-operand path needs a fix before merging.
centrallix-os/sys/js/ht_render.js
|
| Filename | Overview |
|---|---|
| centrallix-os/sys/js/ht_render.js | Adds cxjs_nullif(), but a null second operand incorrectly nullifies a non-null first operand. |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
centrallix-os/sys/js/ht_render.js:324-325
**Null Second Operand Drops Value**
When `a` is non-null and `b` is null, this branch returns null instead of `a`. For example, `cxjs_nullif('value', null)` produces null, so client expressions can disagree with the server-side `NULLIF` result.
```suggestion
if (a == null || a == b) return null;
return a;
```
Reviews (1): Last reviewed commit: "Add cxjs_nullif()." | Re-trigger Greptile
|
This PR is cleared for human review. |
|
Let's fix the behavior on the server and client to match other SQLs on the case of |
@gbeeley In the case where the first argument is null, both the Centrallix server and client (Claude says that Oracle SQL rejects the literal value null at parse-time but follows this pattern and returns null if given a column value or expression that evaluates to null.) |
|
Oops, typo, let's fix the behavior on both server and client to match other SQLs, e.g. if |
|
@gbeeley Ahh, understood. Updated. |
This PR will add the
cxjs_nullif()on the client, which runs with the same logic as the server-side version.