Allow NULL in identities.organization on MySQL (#10148) - #10247
Open
MiMoHo wants to merge 1 commit into
Open
Conversation
The PostgreSQL and SQLite schemas allow NULL in the
identities.organization column, but MySQL defined it as NOT NULL.
An INSERT with an explicit NULL - e.g. an identity record supplied
via the identity_create/user_create hooks by a plugin such as
new_user_identity with an LDAP lookup - fails on MySQL with:
DB Error: [1048] Column 'organization' cannot be null
which in turn aborts the creation of new user accounts.
Unify the schemas by dropping the NOT NULL constraint on MySQL,
matching the PostgreSQL definition.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MiMoHo
force-pushed
the
fix-identities-organization-null-10148
branch
from
July 19, 2026 02:26
f74d47f to
3ec4347
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10148
Problem
The
identities.organizationcolumn allows NULL on PostgreSQL and SQLite, but is defined asNOT NULL DEFAULT ''on MySQL. As noted in #10148, the schemas should be unified.An
INSERTwith an explicit NULL fails on MySQL (with the default strict SQL mode) with:rcube_user::insert_identity()passes identity records through as-is, so a NULLorganizationsupplied via theuser_create/identity_createhooks (e.g. by thenew_user_identityplugin when the LDAP attribute is absent) triggers this error and aborts the creation of new user accounts — which matches the reporter's observation that new accounts could not log in until the plugin was disabled.Changes
SQL/mysql.initial.sql:organization varchar(128) NOT NULL DEFAULT ''→organization varchar(128) DEFAULT NULL(matches the PostgreSQL definition)2026070500.sql(MySQL:ALTER TABLE ... MODIFY; comment-only placeholder for PostgreSQL/SQLite, as in previous single-driver migrations)roundcube-versionstamp in all three*.initial.sqlfilesNot touched (possible follow-up):
reply-toandbcchave the same NULL-ability divergence between MySQL/SQLite and PostgreSQL, and SQLite keeps itsDEFAULT ''fororganization(changing a column default in SQLite would require a table rebuild, which seems disproportionate here since the NULL insert already works there).Testing
Verified locally against MariaDB 12.3 (strict mode:
STRICT_TRANS_TABLES,...) and SQLite; theMODIFYstatement is elementary DDL and follows the same pattern already used for this very column inSQL/mysql/2011121400.sql:mysql.initial.sql, inserted an identity withorganization = NULL→ fails withERROR 1048 (23000): Column 'organization' cannot be nullmysql.initial.sql→ column isNULL-able, NULL insert succeeds, version stamped2026070500bin/updatedb.sh --package=roundcube --dir=SQL→ migration applies cleanly, NULL insert succeeds, version updatedSHOW CREATE TABLE identitiesis identical between a fresh install and an upgraded installbin/updatedb.shand bumps the stored versionRcubeTest::test_execdue to BSD vs GNUdateon macOS)This contribution was prepared with AI assistance (Claude Code); the analysis and all test results above were verified against a real database as described.
🤖 Generated with Claude Code