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

Add linter to check for jsonb_set to avoid setting NULL #36

Open
RyanSquared opened this issue Oct 19, 2019 · 1 comment
Open

Add linter to check for jsonb_set to avoid setting NULL #36

RyanSquared opened this issue Oct 19, 2019 · 1 comment

Comments

@RyanSquared
Copy link
Member

20:44 lee=# select jsonb_set('{"foo":"aaaaaa","bar":[444, 555, {"test": false, "failed": 1}]}'::jsonb, '{foo}', NULL);
20:44 jsonb_set
20:44 -----------

The usage of NULL rather than 'null'::jsonb clears out the JSON values.

@RyanSquared
Copy link
Member Author

This would have to be not a literal NULL check but instead ensure either a literal value or a coalesce(<input here>, 'null'::jsonb)

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

1 participant