You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When posting some data today emoncms (Version [11.4.6]) that was going to create a new input I was getting an error:
EMONCMS Result: 200, <br /> <b>Fatal error</b>: Uncaught mysqli_sql_exception: Field 'record' doesn't have a default value in /var/www/html/emoncms/Modules/input/input_model.php:41 Stack trace: #0 /var/www/html/emoncms/Modules/input/input_model.php(41): mysqli_stmt->execute() #1 /var/www/html/emoncms/Modules/input/input_methods.php(328): Input->create_input(10, '99', 'C1') #2 /var/www/html/emoncms/Modules/input/input_methods.php(182): InputMethods->process_node('10', 1711131893, '99', Array) #3 /var/www/html/emoncms/Modules/input/input_controller.php(54): InputMethods->post('10') #4 /var/www/html/emoncms/core.php(74): input_controller() #5 /var/www/html/emoncms/index.php(242): controller('input') #6 {main} thrown in <b>/var/www/html/emoncms/Modules/input/input_model.php</b> on line <b>41</b><br />
So the sql line 39 of input_model.php is failing: if ($stmt = $this->mysqli->prepare("INSERT INTO input (userid,name,nodeid,description,processList) VALUES (?,?,?,'','')")) {
because the table "Input" field "record" doesn't have a default value, it doesn't allow nulls and the INSERT is not explicitly posting one.
Not sure how I got here - meaning which upgrade broke it - but it's been a while since I've tried to create new inputs.
I looked at the existing records in the input table and they all have a value of 0 for field record so I'm adding that as a default which should fix it.
I'm opening this issue as a heads up that maybe something that used to use record doesn't anymore in an upgrade but I have a db with old schema and maybe "record" is an obsolete field?
Thanks,
Andy.
The text was updated successfully, but these errors were encountered:
Yes that fixed it: ALTER TABLE input ALTER record SET default 0;
As soon as that was done the data posting returned with no errors and my new inputs were populated on the input/view page.
Like I hinted earlier, this may not be an issue for a fresh BNIB install of emoncms. It may be because I've had the db for years and updated emoncms along the way & somewhere field record was depreciated. There may be others out there with the issue hiding covertly on their db too.
If that's the case it would be good to know and I can go ahead and drop it altogether.
When posting some data today emoncms (Version [11.4.6]) that was going to create a new input I was getting an error:
EMONCMS Result: 200, <br /> <b>Fatal error</b>: Uncaught mysqli_sql_exception: Field 'record' doesn't have a default value in /var/www/html/emoncms/Modules/input/input_model.php:41 Stack trace: #0 /var/www/html/emoncms/Modules/input/input_model.php(41): mysqli_stmt->execute() #1 /var/www/html/emoncms/Modules/input/input_methods.php(328): Input->create_input(10, '99', 'C1') #2 /var/www/html/emoncms/Modules/input/input_methods.php(182): InputMethods->process_node('10', 1711131893, '99', Array) #3 /var/www/html/emoncms/Modules/input/input_controller.php(54): InputMethods->post('10') #4 /var/www/html/emoncms/core.php(74): input_controller() #5 /var/www/html/emoncms/index.php(242): controller('input') #6 {main} thrown in <b>/var/www/html/emoncms/Modules/input/input_model.php</b> on line <b>41</b><br />
So the sql line 39 of input_model.php is failing:
if ($stmt = $this->mysqli->prepare("INSERT INTO input (userid,name,nodeid,description,processList) VALUES (?,?,?,'','')")) {
because the table "Input" field "record" doesn't have a default value, it doesn't allow nulls and the INSERT is not explicitly posting one.
Not sure how I got here - meaning which upgrade broke it - but it's been a while since I've tried to create new inputs.
I looked at the existing records in the input table and they all have a value of 0 for field record so I'm adding that as a default which should fix it.
I'm opening this issue as a heads up that maybe something that used to use record doesn't anymore in an upgrade but I have a db with old schema and maybe "record" is an obsolete field?
Thanks,
Andy.
The text was updated successfully, but these errors were encountered: