- Status changed to Postponed: needs info
over 1 year ago 2:42pm 23 March 2023 Please add steps or code to reproduce the error. I don't get this error or have any issues adding users.
- 🇮🇳India nishantkumar155
We are facing this as uid is not processing in updb. we moved from Drupal 8.9.20 to Drupal 9.5.7 . Due to this we are unable to create new user getting error null can not be inserted on uid.
- Status changed to Active
over 1 year ago 8:51pm 11 April 2023 If you create a clean Drupal site with this module installed, do you have the error when inserting a user? If not, then the error could be something with your configuration or another module.
Try starting from a new Drupal site and try to figure out the root cause. If you don't do any debugging, this issue will never get fixed, because I highly doubt anybody knows how to reproduce the issue given the information provided above.
- 🇮🇳India raajkumar.kuru Chennai
Issue is because of Drupal Core upgrade and Drupal already sending Notice while we doing updb
Here is the update hook
user_update_9301To resolve Follow this steps
Open the database in SQL Management Studio.
Right-click on the users table
Select Script Table as -> Create to -> New Query Editor Window. This will generate a script to recreate the table in a new query window.
Change the table name and relative keys & constraints in the script to users_temp.
Execute the script.
Then for copying the data run this below script:SET IDENTITY_INSERT users_temp ON
INSERT Into users_temp ([Column1], [Column2], [Column3], [Column4],... )
SELECT [Column1], [Column2], [Column3], [Column4],... FROM usersSET IDENTITY_INSERT users_temp OFF
Then Rename the users table to any name
Next change the users_temp name to users and it will work. - 🇮🇳India nishantkumar155
@raajKumar ,
I confirm #14 Solved over issue , This issue should be implement over the hook level.
- 🇬🇧United Kingdom pstewart
Noting that the underlying issue that caused this problem in 🐛 Upgrading to Drupal 9.3.x changes users table and locks users out of the site Needs work has now been fixed in 4.4.x, however an update hook would still need to be implemented to facilitate upgrades to 9.3.x. By this point that's probably not going to happen as most affected people will already have done a manual workaround with 4.3, and D9 is now EOL. I'll leave this issue open for now for discoverability and in case anyone wants to have a go at implementing the required hook, otherwise this should be considered as 'Closed (won't fix)'. Anyone still running into this problem can either apply the workaround in #14 or attempt to run the pertinent lines from the original
user_update_9301
implementation:$connection = \Drupal::database(); $connection->schema()->dropPrimaryKey('users'); $connection->schema()->changeField('users', 'uid', 'uid', ['type' => 'serial', 'not null' => TRUE], ['primary key' => ['uid']]);