📝 Bug Summary
The SQL import process fails when attempting to import maillogsentinel events into the SQLite database. The error indicates that the asn_int column in the maillogsentinel_events table is receiving NULL values but has a NOT NULL constraint defined. This prevents the entire SQL import transaction from completing and leaves the database in an inconsistent state.
🔍 Steps to Reproduce
- Launch the database import mode by running:
python3 /usr/local/bin/maillogsentinel.py --sql-import
- Wait for the extraction and offset saving to complete successfully
- Observe the SQL import process starting
- The SQL import process fails during transaction execution
❌ Actual Result
The SQL import process crashes with the following error:
sqlite3.IntegrityError: NOT NULL constraint failed: maillogsentinel_events.asn_int
The transaction rolls back (as intended) but the process exits with failure status without successfully importing the events. No data is written to the database.
✅ Expected Result
The SQL import process should complete successfully and import all event records from the exported SQL file into the maillogsentinel_events table without constraint violations.
🌍 Runtime Context
- Affected version(s): 5.15.x
- Environment(s): Production
- OS: Debian 13.1 - Trixie
- Python version: 3.13.x
- Relevant file:
/usr/local/bin/lib/maillogsentinel/sql_importer.py (line 467)
📋 Logs / Error Messages
▲ Starting SQL import process...
sql_db: SQLite error processing file 20251016_2052_maillogsentinel_export.sql: NOT NULL constraint failed: maillogsentinel_events.asn_int. The transaction in the file should have rolled back.
Traceback (most recent call last):
File "/usr/local/bin/lib/maillogsentinel/sql_importer.py", line 467, in run_sql_import
conn.executescript(
~~~~~~~~~~~~~~~~~~^
sql_script
^^^^^^^^^^
) # This will commit if successful, or rollback if error within script
^
sqlite3.IntegrityError: NOT NULL constraint failed: maillogsentinel_events.asn_int
✗ Some steps failed. SQL import failed.
🔧 Workaround (if any)
Temporarily modify the maillogsentinel_events table schema to allow NULL values in the asn_int column, though this is not a proper fix and may cause data integrity issues downstream.
📊 Impact Assessment
- Users affected: All users wishing to import the extracted data into the database
- Systems affected: Production SQL import workflow
- Business impact: SQL import feature is completely non-functional; events cannot be imported into the database for reporting/analysis
📝 Bug Summary
The SQL import process fails when attempting to import maillogsentinel events into the SQLite database. The error indicates that the
asn_intcolumn in themaillogsentinel_eventstable is receiving NULL values but has a NOT NULL constraint defined. This prevents the entire SQL import transaction from completing and leaves the database in an inconsistent state.🔍 Steps to Reproduce
python3 /usr/local/bin/maillogsentinel.py --sql-import❌ Actual Result
The SQL import process crashes with the following error:
The transaction rolls back (as intended) but the process exits with failure status without successfully importing the events. No data is written to the database.
✅ Expected Result
The SQL import process should complete successfully and import all event records from the exported SQL file into the
maillogsentinel_eventstable without constraint violations.🌍 Runtime Context
/usr/local/bin/lib/maillogsentinel/sql_importer.py(line 467)📋 Logs / Error Messages
🔧 Workaround (if any)
Temporarily modify the
maillogsentinel_eventstable schema to allow NULL values in theasn_intcolumn, though this is not a proper fix and may cause data integrity issues downstream.📊 Impact Assessment