Unsupported syntax of a query

Created on 10 April 2025, 14 days ago

Problem/Motivation

The query that was introduced with #3285521: Add maximum emails per hour feature β†’ seems to not be widely supported. We first noticed issues with it during a deployment where in the logs the following error was logged:

SQLSTATE[HY000]: General errror: 1366 Incorrect integer value: " for column 'timestamp' at row 1

Initially we were unable to identify what causes it until a test running on SQLite was more descriptive with its error at the same place:

SQLSTATE[HY000]: General error: 1 near "HOUR": syntax error: SELECT COUNT(*
) FROM "watchdog_mailer_history" WHERE timestamp BETWEEN UNIX_TIMESTAMP(DAT
E_ADD(NOW(), INTERVAL -1 HOUR)) AND UNIX_TIMESTAMP(); Array ()

From my checking it seems that DATE_ADD is not available in SQLite which causes the issue over there, but I am still unsure why the issue was triggered during a deployment where we are using MySQL 5.7.42 / Percona Server (GPL) Release 46.

Steps to reproduce

Proposed resolution

Set the timestamp variables in PHP for a wide range of support of databases.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024