I'm using mysql
for node.js.
This query checks if a column has all NULL
values, by checking if at least one row is not NULL
.
SELECT 1 FROM `table` WHERE `column` IS NOT NULL LIMIT 1
If the column has all NULL
values, this query ends in the SQL processlist after a few seconds (~120), but I never get a callback from the js code:
import {createPool as mysqlCreatePool, MysqlError} from 'mysql';
const db = mysqlCreatePool({...})
const query = db.query(sql, undefined, function (err: MysqlError | null, res?: any) {
console.log(err, res);
});
query.on('end', () => console.log("end"));
(Nothing is ever printed in the console)