Unable to delete a user

Concrete: 9.2.2
PHP: 8.2.1

When trying to delete a user we’re seeing the following error:

Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException thrown with message "An exception occurred while executing 'DELETE FROM Users WHERE uID = ?' with params [6]:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`db`.`AnnouncementUserViews`, CONSTRAINT `FK_B721E7B9FD71026C` FOREIGN KEY (`uID`) REFERENCES `Users` (`uID`))"

Stacktrace:
#46 Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:68
#45 Doctrine\DBAL\Driver\AbstractMySQLDriver:convertException in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:182
#44 Doctrine\DBAL\DBALException:wrapException in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:159
#43 Doctrine\DBAL\DBALException:driverExceptionDuringQuery in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:2222
#42 Doctrine\DBAL\Connection:handleExceptionDuringQuery in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1537
#41 Doctrine\DBAL\Driver\PDO\Exception in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
#40 Doctrine\DBAL\Driver\PDO\Exception:new in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119
#39 PDOException in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
#38 PDOStatement:execute in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
#37 Doctrine\DBAL\Driver\PDOStatement:execute in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1527
#36 Doctrine\DBAL\Connection:executeStatement in /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:816
#35 Doctrine\DBAL\Connection:delete in /var/www/html/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:603
#34 Doctrine\ORM\Persisters\Entity\BasicEntityPersister:delete in /var/www/html/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1259
#33 Doctrine\ORM\UnitOfWork:executeDeletions in /var/www/html/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:454
#32 Doctrine\ORM\UnitOfWork:commit in /var/www/html/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:403
#31 Doctrine\ORM\EntityManager:flush in /var/www/html/concrete/src/User/UserInfo.php:310
#30 Concrete\Core\User\UserInfo:delete in /var/www/html/concrete/src/Workflow/Request/DeleteUserRequest.php:39
#29 Concrete\Core\Workflow\Request\DeleteUserRequest:approve in /var/www/html/concrete/src/Workflow/EmptyWorkflow.php:24
#28 Concrete\Core\Workflow\EmptyWorkflow:start in /var/www/html/concrete/src/Workflow/Progress/Progress.php:239
#27 Concrete\Core\Workflow\Progress\Progress:start in /var/www/html/concrete/src/Workflow/Request/UserRequest.php:68
#26 Concrete\Core\Workflow\Request\UserRequest:addWorkflowProgress in /var/www/html/concrete/src/Workflow/Request/Request.php:142
#25 Concrete\Core\Workflow\Request\Request:triggerRequest in /var/www/html/concrete/src/Workflow/Request/UserRequest.php:45
#24 Concrete\Core\Workflow\Request\UserRequest:trigger in /var/www/html/concrete/src/User/UserInfo.php:208
#23 Concrete\Core\User\UserInfo:triggerDelete in /var/www/html/concrete/controllers/single_page/dashboard/users/search.php:325
#22 Concrete\Controller\SinglePage\Dashboard\Users\Search:update_status in /var/www/html/concrete/src/Controller/AbstractController.php:318
#21 call_user_func_array in /var/www/html/concrete/src/Controller/AbstractController.php:318
#20 Concrete\Core\Controller\AbstractController:runAction in /var/www/html/concrete/src/Http/ResponseFactory.php:193
#19 Concrete\Core\Http\ResponseFactory:controller in /var/www/html/concrete/src/Http/ResponseFactory.php:372
#18 Concrete\Core\Http\ResponseFactory:collection in /var/www/html/concrete/src/Http/DefaultDispatcher.php:132
#17 Concrete\Core\Http\DefaultDispatcher:handleDispatch in /var/www/html/concrete/src/Http/DefaultDispatcher.php:60
#16 Concrete\Core\Http\DefaultDispatcher:dispatch in /var/www/html/concrete/src/Http/Middleware/DispatcherDelegate.php:39
#15 Concrete\Core\Http\Middleware\DispatcherDelegate:next in /var/www/html/concrete/src/Http/Middleware/FrameOptionsMiddleware.php:39
#14 Concrete\Core\Http\Middleware\FrameOptionsMiddleware:process in /var/www/html/concrete/src/Http/Middleware/MiddlewareDelegate.php:50
#13 Concrete\Core\Http\Middleware\MiddlewareDelegate:next in /var/www/html/concrete/src/Http/Middleware/StrictTransportSecurityMiddleware.php:36
#12 Concrete\Core\Http\Middleware\StrictTransportSecurityMiddleware:process in /var/www/html/concrete/src/Http/Middleware/MiddlewareDelegate.php:50
#11 Concrete\Core\Http\Middleware\MiddlewareDelegate:next in /var/www/html/concrete/src/Http/Middleware/ContentSecurityPolicyMiddleware.php:36
#10 Concrete\Core\Http\Middleware\ContentSecurityPolicyMiddleware:process in /var/www/html/concrete/src/Http/Middleware/MiddlewareDelegate.php:50
#9 Concrete\Core\Http\Middleware\MiddlewareDelegate:next in /var/www/html/concrete/src/Http/Middleware/CookieMiddleware.php:35
#8 Concrete\Core\Http\Middleware\CookieMiddleware:process in /var/www/html/concrete/src/Http/Middleware/MiddlewareDelegate.php:50
#7 Concrete\Core\Http\Middleware\MiddlewareDelegate:next in /var/www/html/concrete/src/Http/Middleware/ApplicationMiddleware.php:29
#6 Concrete\Core\Http\Middleware\ApplicationMiddleware:process in /var/www/html/concrete/src/Http/Middleware/MiddlewareDelegate.php:50
#5 Concrete\Core\Http\Middleware\MiddlewareDelegate:next in /var/www/html/concrete/src/Http/Middleware/MiddlewareStack.php:86
#4 Concrete\Core\Http\Middleware\MiddlewareStack:process in /var/www/html/concrete/src/Http/DefaultServer.php:85
#3 Concrete\Core\Http\DefaultServer:handleRequest in /var/www/html/concrete/src/Foundation/Runtime/Run/DefaultRunner.php:128
#2 Concrete\Core\Foundation\Runtime\Run\DefaultRunner:run in /var/www/html/concrete/src/Foundation/Runtime/DefaultRuntime.php:102
#1 Concrete\Core\Foundation\Runtime\DefaultRuntime:run in /var/www/html/concrete/dispatcher.php:45
#0 require in /var/www/html/index.php:2

Is this a custo addon table or something? It seems like it references a user, but maybe when a user was deleted, that operation wasn’t extended to delete the reference from this custom table?

Thanks for getting back. The table you identified helped me do some more research. Looks like it was a known issue and fixed in a 9.2.4 release.

2 Likes