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

nullValue does not output "null" string #288

Closed
arina-ielchiieva opened this issue Apr 8, 2019 · 3 comments
Closed

nullValue does not output "null" string #288

arina-ielchiieva opened this issue Apr 8, 2019 · 3 comments

Comments

@arina-ielchiieva
Copy link
Collaborator

arina-ielchiieva commented Apr 8, 2019

!set nullValue null
values (null, -1.5);

Result:

+----+------+
| C1 |  C2  |
+----+------+
|    | -1.5 |
+----+------+

Though if to set null value in camel case everything works as expected:

!set nullValue Null
values (null, -1.5);

Result:

+------+------+
|  C1  |  C2  |
+------+------+
| Null | -1.5 |
+------+------+

Issue is mostly likely because when comparing property default and current value, these values are compared as strings but null and "null" are different values.

https://github.com/julianhyde/sqlline/blob/master/src/main/java/sqlline/SqlLineOpts.java#L410

@julianhyde
Copy link
Owner

I have never liked the idea of using "null" as a special value in !set. Or the idea of comparing with default values.

Instead, I think we should have an !unset command. Then "null" would no longer have a special meaning; it would just be a string with 4 characters.

@arina-ielchiieva
Copy link
Collaborator Author

If nullValue is not set / default, nulls are output as empty strings. Setting "null" value to nullValue property allowed to output nulls as "null" (worked in 1.6, broke in 1.7). We do have !reset command which can reset properties to their defaults but still nulls will be output as empty strings in this case.
PR with the fix - #300.

@julianhyde
Copy link
Owner

Fixed in a689205, PR #300. Thanks @arina-ielchiieva!

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

No branches or pull requests

2 participants