Bug 2023493 - sqlgrey service fails to start when using mysql backend
Summary: sqlgrey service fails to start when using mysql backend
Keywords:
Status: NEW
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: sqlgrey
Version: epel8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-15 21:45 UTC by Lance Albertson
Modified: 2021-11-15 21:45 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
sqlgrey-1.8.0-no-zero-in-date.patch (752 bytes, patch)
2021-11-15 21:45 UTC, Lance Albertson
no flags Details | Diff

Description Lance Albertson 2021-11-15 21:45:06 UTC
Created attachment 1841916 [details]
sqlgrey-1.8.0-no-zero-in-date.patch

Description of problem:

I noticed that sqlgrey was finally added to epel8 but unfortunately I ran into
an issue on CentOS 8 where the service fails to start due to some sql error.

Version-Release number of selected component (if applicable):

1.8.0-22.el8

How reproducible:

Steps to Reproduce:
1. Install sqlgrey and Percona MySQL 5.7
2. Create user and database for sqlgrey
3. Start service

Actual results:


sqlgrey[15291]: warning: Use of uninitialized value $DBI::errstr in concatenation (.) or string at /usr/sbin/sqlgrey line 246.
sqlgrey[15291]: dbaccess: warning: couldn't do query:
    CREATE TABLE from_awl (sender_name varchar(64) NOT NULL, sender_domain varchar(255) NOT NULL, src varchar(39) NOT NULL, first_seen timestamp NOT NULL, last_seen timestamp NOT NULL, PRIMARY KEY (src, sender_domain, sender_name)):
    , reconnecting to DB
sqlgrey[15291]: mail: failed to send:
sqlgrey[15291]: fatal: create_from_awl_table error at /usr/sbin/sqlgrey line 195.

When I try running the query manually, I get the following:

mysql> CREATE TABLE from_awl (sender_name varchar(64) NOT NULL, sender_domain varchar(255) NOT NULL, src varchar(39) NO
ERROR 1067 (42000): Invalid default value for 'last_seen'

Expected results:

Additional info:

I did some additional digging and discovered if I run the following query ahead
of time:

SET @@session.sql_mode ="NO_ZERO_IN_DATE";

It works:

mysql> CREATE TABLE from_awl (sender_name varchar(64) NOT NULL, sender_domain varchar(255) NOT NULL, src varchar(39) NO
T NULL, first_seen timestamp NOT NULL, last_seen  timestamp NOT NULL, PRIMARY KEY (src, sender_domain, sender_name));
Query OK, 0 rows affected (0.07 sec)

I've included a patch which I've applied on a local package we've been using
that should fix the problem.


Note You need to log in before you can comment on or make changes to this bug.