Inspectopedia
 
2024.3

Redundant code in COALESCE call

Warning
New
Last modified: 03 December 2024

Reports all the arguments except for the first expression that does not evaluate to NULL in COALESCE functions.

Example (MySQL):

SELECT COALESCE(NULL, NULL, NULL, 42, NULL, 'string') as a;

The first NOT NULL argument is 42, all other arguments will be grayed out.