Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Can't delete user
#1
mybb1.4.2 and PostgreSQL. When trying to delete a user I get:

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
0 - ERROR: update or delete on table "mybb_users" violates foreign key constraint "mybb_userfields_ufid_fkey" on table "mybb_userfields" DETAIL: Key (uid)=(3) is still referenced from table "mybb_userfields".
Query:
DELETE FROM mybb_users WHERE uid='3'

Any ideas ?

Thanks
#2
Table not installed correctly?
Pic-monster My site does work! You're just visiting wrong url!
#3
(10-17-2008, 02:53 PM)mcgroove Wrote: Table not installed correctly?

How to check ?
#4
Looks like a possble postgre/mybb bug. I don't know any postgre to help you further.
#5
In admin/modules/user/users.php, find:

                $db->delete_query("users", "uid='{$user['uid']}'");
                $db->delete_query("userfields", "ufid='{$user['uid']}'");
                $db->delete_query("privatemessages", "uid='{$user['uid']}'");
                $db->delete_query("events", "uid='{$user['uid']}'");
                $db->delete_query("moderators", "uid='{$user['uid']}'");
                $db->delete_query("forumsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("threadsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("sessions", "uid='{$user['uid']}'");
                $db->delete_query("banned", "uid='{$user['uid']}'");
                $db->delete_query("threadratings", "uid='{$user['uid']}'");
Replace with:

                $db->delete_query("userfields", "ufid='{$user['uid']}'");
                $db->delete_query("privatemessages", "uid='{$user['uid']}'");
                $db->delete_query("events", "uid='{$user['uid']}'");
                $db->delete_query("moderators", "uid='{$user['uid']}'");
                $db->delete_query("forumsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("threadsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("sessions", "uid='{$user['uid']}'");
                $db->delete_query("banned", "uid='{$user['uid']}'");
                $db->delete_query("threadratings", "uid='{$user['uid']}'");
                $db->delete_query("users", "uid='{$user['uid']}'");

Sorry I don't have an installation of PgSQL to test on, so please reply back if it works or not, or if there are any other issues.
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
#6
(10-17-2008, 06:21 PM)DennisTT Wrote: In admin/modules/user/users.php, find:

                $db->delete_query("users", "uid='{$user['uid']}'");
                $db->delete_query("userfields", "ufid='{$user['uid']}'");
                $db->delete_query("privatemessages", "uid='{$user['uid']}'");
                $db->delete_query("events", "uid='{$user['uid']}'");
                $db->delete_query("moderators", "uid='{$user['uid']}'");
                $db->delete_query("forumsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("threadsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("sessions", "uid='{$user['uid']}'");
                $db->delete_query("banned", "uid='{$user['uid']}'");
                $db->delete_query("threadratings", "uid='{$user['uid']}'");
Replace with:

                $db->delete_query("userfields", "ufid='{$user['uid']}'");
                $db->delete_query("privatemessages", "uid='{$user['uid']}'");
                $db->delete_query("events", "uid='{$user['uid']}'");
                $db->delete_query("moderators", "uid='{$user['uid']}'");
                $db->delete_query("forumsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("threadsubscriptions", "uid='{$user['uid']}'");
                $db->delete_query("sessions", "uid='{$user['uid']}'");
                $db->delete_query("banned", "uid='{$user['uid']}'");
                $db->delete_query("threadratings", "uid='{$user['uid']}'");
                $db->delete_query("users", "uid='{$user['uid']}'");

Sorry I don't have an installation of PgSQL to test on, so please reply back if it works or not, or if there are any other issues.

Hi Dennis,
yep, solved the problem. Good stuff.
Thanks!
#7
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net


Forum Jump:


Users browsing this thread: 1 Guest(s)