Page MenuHomePhabricator

MySQL error 1048 - "column user_id cannot be null" when creating users
Closed, DeclinedPublic

Description

Author: r.michell

Description:

environment:

MySQL-4.1.16
PHP-5.1.2
Apache-1.3.34
MediaWiki-1.5.6

general:

MediaWiki generated an error message when adding a new user account from same IP
range as existing accounts (different details, different email address,
different user/pass etc) - weird thing is there were entries in the wiki_user
table already...!!?

specifics:

1: "Create an account or Login" (hyperlink) ->
2: [Fill in all fields] ->
3: "New Account" (button) ->
4:

"Database error
From [My]Wiki
A database query syntax error has occurred. This may indicate a bug in the
software. The last attempted database query was:

(SQL query hidden)

from within function "User::addToDatabase". MySQL returned error "1048: Column
'user_id' cannot be null (localhost)".


Version: 1.5.x
Severity: major
OS: Linux
Platform: Other

Details

Reference
bz4797

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 9:05 PM
bzimport set Reference to bz4797.
bzimport added a subscriber: Unknown Object (MLST).

This sounds like either the table definition is bogus (missing the
autoincrement field option) or MySQL is configured in some very strange
nonstandard way which causes it to behave differently.

robchur wrote:

(In reply to comment #0)

In order to check if it's the first part of comment #1 or not, please run
DESCRIBE <table>, where <table> is the name of the user table, including the
database prefix.

r.michell wrote:

I ran #>DESC wiki_user; and the auto_increment attribute was indeed missing from
the table definition!
Strange. However - I would not discount the possibility that someone here (inc
myself) could have messed this up.

I have altered the table and the bug no longer occurs.

Please advise if the "WORKSFORME" value of the new Bug Status is incorrect and I
will change it, otherwise my thanks to you both.