-
-
Notifications
You must be signed in to change notification settings - Fork 641
Open
Labels
Description
Hello,
I think I found an issue with the supportBigNumbers connection option. Running this quick test:
const mysql = require('mysql2/promise');
async function test() {
const connection = await mysql.createConnection({uri: 'mysql://...', supportBigNumbers: true});
const [results] = await connection.query(`
SELECT
-9007199254740993 AS 'MIN_SAFE_INTEGER - 2',
-9007199254740992 AS 'MIN_SAFE_INTEGER - 1',
-9007199254740991 AS 'MIN_SAFE_INTEGER',
-9007199254740990 AS 'MIN_SAFE_INTEGER + 1',
-9007199254740989 AS 'MIN_SAFE_INTEGER + 2',
9007199254740989 AS 'MAX_SAFE_INTEGER - 2',
9007199254740990 AS 'MAX_SAFE_INTEGER - 1',
9007199254740991 AS 'MAX_SAFE_INTEGER',
9007199254740992 AS 'MAX_SAFE_INTEGER + 1',
9007199254740993 AS 'MAX_SAFE_INTEGER + 2'
`);
console.log(results[0]);
connection.end();
}
test();Results in the following:
{
'MIN_SAFE_INTEGER - 2': '-9007199254740993',
'MIN_SAFE_INTEGER - 1': -9007199254740992, // Expecting this to be a string
'MIN_SAFE_INTEGER': -9007199254740991,
'MIN_SAFE_INTEGER + 1': -9007199254740990,
'MIN_SAFE_INTEGER + 2': -9007199254740989,
'MAX_SAFE_INTEGER - 2': 9007199254740989,
'MAX_SAFE_INTEGER - 1': 9007199254740990,
'MAX_SAFE_INTEGER': 9007199254740991,
'MAX_SAFE_INTEGER + 1': 9007199254740992, // Expecting this to be a string
'MAX_SAFE_INTEGER + 2': '9007199254740993'
}Given the values of Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER, shouldn't the values highlighted above be strings?
Thanks!