Database Error: Field 'ua_os' doesn't have a default value

Started by valis1952, April 06, 2022, 10:31:22 PM

Previous topic - Next topic

valis1952

After upgrade to 2.1.1 from 2.0.19 I get this when attempting to post new

QuoteField 'ua_os' doesn't have a default value
File: /var/www/vhosts/xxxx.net/yyyy.net/forum/Sources/Subs-Post.php
Line: 1896

I check Subs-Post.php line 1896:

Quote1891 // Insert the post.
1892   $msgOptions['id'] = $smcFunc['db_insert']('',
1893      '{db_prefix}messages',
1894      $message_columns,
1895      $message_parameters,
1896      array('id_msg'),
1897      1
1898   );

Any clues? thx

Sir Osis of Liver

When in Emor, do as the Snamors.
                              - D. Lister

Kindred

So, give the field a default of NULL by using phpmyadmin in the sql
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Quote from: Sir Osis of Liver on April 06, 2022, 10:59:29 PMHave you installed any mods?


This is from the old "log user agent and operating system on posts" mod.
Holder of controversial views, all of which my own.


Doug Heffernan

Quote from: Arantor on April 07, 2022, 03:14:52 AM
Quote from: Sir Osis of Liver on April 06, 2022, 10:59:29 PMHave you installed any mods?


This is from the old "log user agent and operating system on posts" mod.

Indeed. I have seen posts about this error quite a few times here.

@valis1952, if you are still using this mod, doing what @Kindred posted above should fix the error. However, if you are not using it anymore, the best course of action imo would be to delete/remove all its fields from the database.

Dzonny

I had a few similar messages after I upgraded to 2.1, just give default null in phpMyAdmin and that should do the trick. ;)

valis1952

Thanks everyone... Mr Newbie here... I can get to phpMyAdmin, and find the file...

But what do I actually do then?

Thx

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Doug Heffernan

Quote from: valis1952 on April 07, 2022, 10:19:42 AMThanks everyone... Mr Newbie here... I can get to phpMyAdmin, and find the file...

It is not a file, but a column/field in the smf_messages table.

Quote from: valis1952 on April 07, 2022, 10:19:42 AMBut what do I actually do then?

Are you still using that mod? If yes, at the smf_messages, go the structure, select the ua_os filed and click the edit button. Next step would be to untick NOT NULL and save the changes. This will allow said field to have a null default value and it will make the error go away.

However, if you are not using the mod anymore, which has added that field, the best course of action imo would be to delete/remove said field altogether from the database. There is no point in cluttering your database with fields/tables left behind from old unused mods.

Hope it helps.

valis1952

Okay. Thanks to everyone who replied. Mission accomplished!


Advertisement: