db error on creating new sub-board...

Started by PoML, May 01, 2020, 07:58:04 AM

Previous topic - Next topic

PoML

Hi!

I just tried to create a sub-board(with the sole intent of having an annual meeting digitally and using threads and polls for members to vote, but this happened way before we got that far)

The sub-board was meant to be quite simple - put at the end of the regular info and admin categories and in another board so as not to draw too much attention before it was ready.

On clicking OK to create, I got the following:

Database error:
Out of range value for column 'id_profile' at row 1
File: /home/35/w313123/www/medlemmer/forum/Sources/Subs-Boards.php
Line: 657


Line 648 to 659 of that file is not helping me a lot:
// Do the updates (if any).
if (!empty($boardUpdates))
$smcFunc['db_query']('', '
UPDATE {db_prefix}boards
SET
' . implode(',
', $boardUpdates) . '
WHERE id_board = {int:selected_board}',
array_merge($boardUpdateParameters, array(
'selected_board' => $board_id,
))
);


My forum has GDPR helper mod, EventMod and TinyPortal on an otherwise pretty standard 2.1 RC2.


Any ideas for how to fix - and before I do somethign stupid - is it safe to try again or do I risk ending up with a corrupt db?

vbgamer45

I would like to see the contents of  $boardUpdates before that statement might give a clue.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

PoML

I have the window with the error message still open. Is there a way to read $boardupdates from the Chrome debugger, or how do you suggest I fint it?

Arantor

How many entries are there in the board profiles table?

SpacePhoenix

What do you get if you do var_dumps on both $board_id and $boardUpdates

PoML

#5
Quote from: Arantor on May 01, 2020, 08:35:43 AM
How many entries are there in the board profiles table?

In the table smf_boards, there are 21 entries, and the one I tried to create is number 21.
That might give a clue to what went wrong, as the description of the new board is not filled in. I used highlight in the board description.

The final 3 entries:

id_board id_cat child_level id_parent board_order id_last_msg id_msg_updated member_groups id_profile name description num_topics num_posts count_posts id_theme override_theme MaxAge MinAge gender_sel redirect unapproved_posts unapproved_topics deny_member_groups
9 1 0 0 20 25095 25095 2,13,11,9,10 1 Styret orienterer Her vil styret fremlegge alt ved foreningens drift... 75 279 0 0 1 80 0 -1 0 0
27 1 0 0 9 24857 24857 11,9,10 4 Nyhetsbrev "månedlig" nyhetsbrev til medlemmer og s... 23 24 0 0 0 80 0 -1 0 0
29 1 0 0 13 24953 24953 2,14,13,11,9,10 1 Lån av SMBs utstyr Tråder for utlån av utstyr og møbler 11 72 0 0 0 80 0 -1 0 0
30 1 0 0 0 0 0 -1,0 1 Digitalt årsmøte 2020 - test 0 0 0 0 0 80 0 -1 0 0


id_profile here is "1" for most boards, and that in turn points to smf_board_permissions, I presume?

PoML

Quote from: SpacePhoenix on May 01, 2020, 08:37:26 AM
What do you get if you do var_dumps on both $board_id and $boardUpdates

Not sure how to do that "after the fact". If I insert a var_dump() function in the Subs-Boards.php routine - is it safe to go through the same process again and get a  new error or do I risk makign matters worse?

Doug Heffernan

I can not reproduce this myself, but can you try to change the type of the id_profile field at the smf_boards table from smallint to bigint?

And of course, make first a backup of the table in question even if it is not necessary for this. Personally I have a habit that whenever I do some changes to the db, I always make a backup of it before hand, no matter how small the change.

PoML

Quote from: doug_ips on May 01, 2020, 08:55:32 AM
I can not reproduce this myself, but can you try to change the type of the id_profile field at the smf_boards table from smallint to bigint?

Would I not need to make the same change also in the same id-field in "smf_board_permissions " if I do that change?
Mind you, the biggest int in the table is "4"  - I don't think a smallint cannot handle the huge number of id's :-)

Arantor

smallint caps out at 32767... I was just wondering about a lot of profiles vs a tinyint but smallint is more than big enough.

Bigint, by the way, is MASSIVE. Far larger than anything in SMF as it is 2^63.

PoML

I found a workaround:

1) Edited the entry in the table for the forum to update the three values that did not make it to be updated - id_parent , child_level and description
2) Visited the admin console to make sure values were written correctly: https://...../forum/index.php?action=admin;area=manageboards;sa=board;boardid=30


Now it seems at least the change I wanted do work.  For the moment I do not have the need for finding the root cause, as we rarely create sub-boards and I have to upgrade soon (?) anyways.
I think it is less risky to keep this than to delete and re-create if there is a bug somewhere.

Thanks for all input so far.

Dag

Advertisement: