Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -
Number of replies: 17

Hello everyone,

I need fast help. I try to import and restore some course. I had the trubleshoot with it. And finaly I got the the message on whole screen :


Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.


I can't do anything trought on site, every button I tach, I get this message.


Do anyone have any idea how to resolve this. I really appriciate all your help.

Average of ratings: -
In reply to Ana N.

Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

Guesses ... that's all! :\

Moodle version might help.  Your version?

The course backup file you were attempting to restore ... does it have 'nu' in the file name?  And from what Moodle is the backup?   By that I mean, same Moodle?   Old backup file from another server or this same server?

Turn on debugging via config.php file.   In config-dist.php file in code directory, Section 7, you'll see the lines one could add to config.php file to get debug output to your screen.

Let's see if Moodle will give us more of a clue.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

Thanks you for reply. Moodle version 3.5.2 (recently upgraded from 3.1.4). 

I don't remmember does the backup file had the 'nu' in the file name ( because I have tried so many times to restore to the new course, or import-I even don't remmember that last time was that restor from file or direct importing from other course). Backup was new (today backup) from the same Moodle. 

The "sid" field does not exist in the "session" table

Debug info: 
Error code: ddlfieldnotexist
Stack trace:
  • line 672 of /lib/dml/moodle_database.php: dml_exception thrown
  • line 1521 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
  • line 292 of /lib/classes/session/manager.php: call to moodle_database->get_record()
  • line 82 of /lib/classes/session/manager.php: call to core\session\manager::initialise_user_session()
  • line 791 of /lib/setup.php: call to core\session\manager::start()
  • line 31 of /config.php: call to require_once()
  • line 30 of /index.php: call to require_once()

I forgot to say, when I did not know what to do more about restoring course, I added the role of manager at each course to me(besides the role of the profesor that I had), which was just before this problem.


Thanks in advance.


Ana


In reply to Ana N.

Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

'nu' in filename meant 'no users' - backups can have course id, short name in the backup file names.

So restoring from backup that came from the same server.

Error points to sessions ... me thinks ... think the recommendation is now NOT to use DB for sessions but files (in moodledata/sessions).

Use your Admin Menu search for 'sessions' to find the settings. Set it NOT to use DB for sessions.

Once it's saved .... log out ... login again.   There should be a 'sessions' directory in moodledata.

Now try your restore.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken, 

I have find the sesion folder in moodledata, it has a two files, but i dont know how to set it NOT to use DB for sessions, throught config.php, or?

I don't have accese to moodle user interface.

Thanks.

Ana

In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

If you are logged on as an admin user one does not need to add manager roles/accounts to all categories/courses to be able to restore a course.  As admin level user you should be able to do anything.

With 2 files present in moodledata/sessions/, sounds like it had been using using files for sessions at one time (date/time stamp of those files will tell ya) ... but may have reverted back some how.

Go to: https://yoursite/admin/settings.php?section=sessionhandling

or set in config.php file which overrides

$CFG->dbsessions='0';

Zero means off.

In the table for sessions, BTW, that column does exist ... or should exist:

mysql> explain mdl_sessions;
+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| id           | bigint(10)   | NO   | PRI | NULL    | auto_increment |
| state        | bigint(10)   | NO   | MUL | 0       |                |
| sid          | varchar(128) | NO   | UNI

So that's strange.  Dunno what's up with that!

Check server logs ... apache error logs ... see any 'Server has gone away' entries?

Restoring a backup does require some resources .. if you see the error above in apache error logs, it refers to your DB server 'going away'.    That's a setting for your DB server ... max_allowed_packets

https://dev.mysql.com/doc/refman/5.7/en/program-variables.html

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

I done it with $CFG->dbsessions='0'; trought config.php. Now, after that, there in moodledata/session folder, there are 5 files (3 new with 0 bytes).

Here is the image of tabele session in mysql


 Do I need to change data to this that you have wrote in previous message, or something else?

+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| id           | bigint(10)   | NO   | PRI | NULL    | auto_increment |
| state        | bigint(10)   | NO   | MUL | 0       |                |
| sid          | varchar(128) | NO   | UNI


I checked the variables on DB server (my hosting provider rised today all PHP variables, but nothing helped). Is this value enough for restore 53 MB backup?



Thanks,


Ana

In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

Session files ... are the date/time stamps on those new files the same as when you logged on after setting the CFG item in config.php ... that means it's working.

What I shared was the command line client query to 'explain' the mdl_sessions table.   Explain shows the structure of the table ... column names, etc. just to show you that the column the error reported should exist does indeed exist.

You were using phpmyadmin and viewing the contents of the table .... not the same.  I was using command line client viewing the output of 'explain'.

No, you shouldn't edit any table manually unless you really iknow what you  are doing.   In this case don't think you need to as it's a matter of config ... me thinks.

Rick might have shared the other variable you might need to add to your DB config ...

max_input_vars = 5000

Restoring a backup is a pretty heavy process and could involve lots of variables.

The value for max_allowed_packet you show doesn't have a designator at the end to indicate what the number represents .... example: max_allowed_packet=950M ... the M means Megabytes.

mysql> show variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name      | Value     |
+--------------------+-----------+
| max_allowed_packet | 996147200 |
+--------------------+-----------+

With no designator, think mysql server will assume it's bytes .... so your setting 268 thousand is around 25M.  Remember this was recommended to change ***IF*** you saw 'Server has gone away' in the apache server error logs.

If you changed that to a higher value, today and did not restart the mysql service, those settings have not taken affect.

IF one changes config of apache/php/ or MySQL and one needs to restart apache or mysqld.

'spirit of sharing', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

I understud all you said about uploading bakup. This message I got every time i have tried to restaur the course.

The thing that I didn't understend is how can I fix this error showing that sid missing from the table session, and how to my site become working again. I must done this as soon as posible, because the students are waiting for learning(learning are related to days).


Thanks in advance.


Ana

In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

The error screen you just shared indicates you need to talk to provider - or the true server tech.

Suspect 'capcity' problems ... not really maintenance ... ONLY provider would know for sure.

A 503 apache error is difficult to determine .... especially remotely via forum information exchange ... and considering your problem has not attracted users in these forums  who *might* host with the same provider as you.   Not all providers are equal.   Not all remotely hosting providers have good environments for Moodle.

If you need to resolve this ASAP, **call** the provider.

This is Windows?  Are you the provider?

When I asked for PHP info from the php info screen ... like handler ... expected this sort of info

Server API   Apache 2.0 Handler

Anyhooooo .... yes, it's always important ... yes students/teachers are expecting this to be resolved.  Have no magic to provide.

I started responding with the statement ... 'all guesses' ... with Windows ... even more ... *wild guesses* ... don't use Windows, myself.

Before all this started, did you make a site backup?   Code, DB dump at least?

 I have taken this as far as I can ... how about you Windows Aces in Moodle Community?  Do we have any?   If so, help out!

Best of luck!

'spirit of sharing', Ken


In reply to Ken Task

Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

I didn't find any error log (I check it througt config.php adding 

ini_set ('display_errors', 'on'); 

ini_set ('log_errors', 'on'); 

 ini_set ('display_startup_errors', 'on'); 

 ini_set ('error_reporting', E_ALL); 

 $CFG->debug = 30719; 


I also check in database table: logstore_standard_log and log_display, and I didnt found any  'Server has gone away' .


Please how you some advice what to do ? I still dont have access to moodle course. Just still appears message 

The "sid" field does not exist in the "session" table

Thanks.

Ana

In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

'Server has gone way' would be in your Apache error log ... not the log tables of Moodle .... now think about that a minute ... if the error caused MySQL server to 'go away', how could moodle record that error in it's tables of the database ... the very thing that 'went away'.

So it's still showing the same error ... sid field does not exist in session table?

In your phpmyadmin see if there is a tool to select a table then show properties or structure of the table.   See if your sessions table has a 'sid' column ... it should contain one.

Although I have no idea why your server is trying to insert data in mdl_sessions when it's supposed to be using files for sessions.

tables mdl_logstore_standard_log and log_display do NOT contain sid column and shouldn't.

Can't make a vulcan mind meld with a server!   Sorry!

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

Yes, I still got the message that sid field does not exist in session table. Session tabel have sid column I saw.


Something I notice now when I waching in phpinfo, at the end of it this show



I dont know but all goes wrong when I add the role of manager to me.


Ana

In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

Well do what All Windows Admins do ... when in doubt ... reboot the server! sad

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, the image above gets cutoff and in looking at it locally, see you are NOT running Windows.

When moving to a VPS, many providers just copy your account files to a VPS ... means you are still using 'user space' ... as evident by the path which includes 'public_html'.

All thoses below the php info are 'warnings' .... not really errors ... but could, with other un-known factors to server config ... be involved in the problems.

*** You do NOT NEED to add youself as manager if you are already an Admin level user.   If that 'hurts' (ie, leads to errors) don't do it.

The service un-available error during a restore you might not be able to solve without help from Provider.   Provider ***MUST GET INVOLVED***.

What are your server specs now that it has been moved off cheapo/shared hosting to a VPS?

How much memory does the new server have?

Where are you hosted?  The provider ... please.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

Thanks for your help. I am glad to tell you that I have solved the problem. When I done everything that drop in my mind, finaly I find in some other topic your message: to delete In moodledata/ the contents of 'cache' and the contents of 'localcache'. I done that and resolve the problem. 

My hosting provider is unlimited.rs, they offer unlimited hosting (not realy unlimited, but they allow to you how much you need)

Best regards,

Ana

In reply to Ana N.

Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ana N. -

Dear Ken,

I have only one more question for you. 

Some questions from the course that I tried to restaur have been copied. I have tried to delete them all, most of are deleted, but four questions I am unable to delete. When I want to open or delete that question, I get this message: Can not find data record in database table qtype_multichoice_options.

Any help or idea what to do?

Thanks.

Ana

In reply to Ana N.

Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Odgovor: Re: Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() no fields found.

by Ken Task -
Picture of Particularly helpful Moodlers

At a time when server isn't all that busy, go to:

https://yourserver/admin/tool/health/

That will autoexecute a 'health check' .... much of it is about Quizzes.   It is pretty intensive so that's why the suggestion to run during non-prime time.   It might find things that could be fixed and provides solutions ... most/all are mysql queries - which can be run from mysql client via command line or one should be able to do them using phpmyadmin.

As with anything that might involve a massive change to DB, strongly advise taking a backup of the DB before running the health check.

'spirit of sharing', Ken


Average of ratings: Useful (2)