You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting an error running the following prepared query using mysql2 (2.2.5) against MySQL 8.0.21:
SELECT
company_id AS companyID,
DATE_FORMAT(created, "%Y-%m-%d") AS`day`,
SUM(unique_chats) AS uniqueChats,
SUM(successful_chats) AS successfulChats,
SUM(visitor_left) AS visitorLeft,
SUM(sent_messages) AS sentMessages,
SUM(received_messages) AS receivedMessages,
SUM(all_messages) AS allMessages
FROM a_hourly
WHERE
company_id = ? AND
created BETWEEN ? AND ?
GROUP BY`day`
The error I get is the following:
Error: format string \"Failed executing query: \"SELECT
company_id AS companyID,
DATE_FORMAT(created, \"%Y-%m-%d\") AS `day`,
SUM(unique_chats) AS uniqueChats,
SUM(successful_chats) AS successfulChats,
SUM(visitor_left) AS visitorLeft,
SUM(sent_messages) AS sentMessages,
SUM(received_messages) AS receivedMessages,
SUM(all_messages) AS allMessages
FROM a_hourly
WHERE
company_id = ? AND
created BETWEEN ? AND ?
GROUP BY `day`\" [2, 2021-01-13T00:00:00Z, 2021-01-14T23:59:59Z]\": conversion specifier \"%d\" at character 3 has no matching argument (too few arguments passed)
at jsError (/data/node_modules/extsprintf/lib/extsprintf.js:173:10)
at jsSprintf (/data/node_modules/extsprintf/lib/extsprintf.js:97:11)
at parseConstructorArguments (/data/node_modules/verror/lib/verror.js:120:26)
at new VError (/data/node_modules/verror/lib/verror.js:153:11)
at ConnectionPool.<anonymous> (/data/node_modules/@leadoo/mysql-connection-pool/dist/ConnectionPool.js:128:27)
at Generator.throw (<anonymous>)
at rejected (/data/node_modules/@leadoo/mysql-connection-pool/dist/ConnectionPool.js:6:65)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
However:
If I run this exact query in MySQL workbench, for instance, it works
If I change from execute to query mode, it works
Could this possibly be related to #1239 ? Some how the statement preparation is failing on the data I'm passing in?
I'm on Node 14, running everything from within Docker containers.
EDIT: In the segment DATE_FORMAT(created, \"%Y-%m-%d\") AS day, created is a TIMESTAMP.
The text was updated successfully, but these errors were encountered:
@perry-mitchell are you sure you are using mysql2 driver? Do you know what's the repo for @leadoo/mysql-connection-pool ? Your error is coming fromextsprintf package that is not used by this driver.
@sidorares That connection pool simply returns a mysql2 instance, without modifying it. That being said, you're right, I can see that extsprintf is from the verror library I'm using. It was obscuring the error, which was just a non-aggregated column issue.
Hi,
I'm getting an error running the following prepared query using mysql2 (2.2.5) against MySQL 8.0.21:
The error I get is the following:
However:
execute
toquery
mode, it worksCould this possibly be related to #1239 ? Some how the statement preparation is failing on the data I'm passing in?
I'm on Node 14, running everything from within Docker containers.
EDIT: In the segment
DATE_FORMAT(created, \"%Y-%m-%d\") AS day
,created
is aTIMESTAMP
.The text was updated successfully, but these errors were encountered: