Repository navigation
Issue with 1.2.0/1.2.1 on MariaDB #33
Copy link
Copy link
Closed
Description
I get this error ActiveRecord::StatementInvalid on SolidQueueMonitor::OverviewController#index:
Trilogy::QueryError: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server
version for the right syntax to use near 'EPOCH FROM created_at) - 1774538672) / 3600 AS INTEGER) AS bucket_idx, COUNT(...'
at line 1 (trilogy_query_recv)
��
According to Claude (it’s really late where I am and I’m jet lagged already):
This is a known compatibility issue — the EXTRACT(EPOCH FROM ...) syntax is PostgreSQL-specific and doesn't work on MariaDB.
Let me find the exact source so we can monkey-patch it.
1 # frozen_string_literal: true │ adapter?
1 ����������������������������������������������������������������������������������│
2 # Monkey-patch SolidQueueMonitor::ChartDataService to recognize the Trilogy�������│
3 # adapter (MariaDB/MySQL) so it uses UNIX_TIMESTAMP instead of the PostgreSQL�����│
4 # EXTRACT(EPOCH FROM ...) syntax.�������������������������������������������������│
5 #���������������������������������������������������������������������������������│
6 # Upstream issue: the gem checks adapter?('mysql') but Trilogy reports its��������│
7 # adapter_name as "Trilogy", not "MySQL2".����������������������������������������│
8 ����������������������������������������������������������������������������������│
9 Rails.application.config.to_prepare do��������������������������������������������│
10 │ SolidQueueMonitor::ChartDataService.prepend(Module.new do�����������������������│
11 │ │ private�����������������������������������������������������������������������│
12 │ │�������������������������������������������������������������������������������│
13 │ │ def adapter?(name)������������������������������������������������������������│
14 │ │ │ adapter_name = ActiveRecord::Base.connection.adapter_name.downcase����������│
15 │ │ │ adapter_name.include?(name) || (name == "mysql" && adapter_name.include? │
│ │ │ ("trilogy"))����������������������������������������������������������������│
16 │ │ end���������������������������������������������������������������������������│
17 │ end)����������������������������������������������������������������������������│
18 end
Anyway, it’s late, I’m copy/pasting on an iPad, so I hope this helps in a little way
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
phmunhoz commentedon Mar 27, 2026
Hi @andyjeffries,
Can you try to point to the main branch of the project into you Gemfile and check if it works?
I've made a PR to fix it and @vishaltps merged it into the main but it's not available in a version yet.
vishaltps commentedon Mar 28, 2026
@phmunhoz Does your fix for MySql will also work for MariaDB? I have never heard of it.
andyjeffries commentedon Mar 28, 2026
phmunhoz commentedon Mar 28, 2026
@vishaltps — MariaDB is essentially a community-driven fork of MySQL, fully compatible in syntax and behavior.
I've opened a pull request #34 with a proper fix. I tested it on a real project by switching between the mysql2 and trilogy adapters, and both work correctly now
vishaltps commentedon Mar 30, 2026
This has been fixed in v1.2.2 (release).
The gem now natively recognizes the Trilogy adapter and uses
UNIX_TIMESTAMPinstead of the PostgreSQL-specificEXTRACT(EPOCH FROM ...)syntax, so the monkey-patch is no longer needed.To upgrade:
Thanks for reporting this!