Error: dml_read_exception: Error reading from database in MySQL 5.7.44

Open
#669 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
mysql, php
Domain
database, testing

Research direction

Start with admin/tool/objectfs/classes/local/report/location_report_builder.php at the failing query and admin/tool/objectfs/tests/local/report/object_status_test.php at test_generate_status_report. Check the query’s compatibility with the reported Aurora MySQL 5.7.44 version, then run that test against the same database version. Done means the test passes and the status report query works on that version.

Written by the indexing model from the issue text.

Description

Php: 7.4.33, auroramysql: 5.7.44, OS: Linux 6.8.0-1021-aws x86_64


1) tool_objectfs\local\report\object_status_test::test_generate_status_report
dml_read_exception: Error reading from database (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'cte_objects AS (
                        SELECT o.contenthash,  o.location
     ' at line 2
WITH
                      cte_objects AS (
                        SELECT o.contenthash,  o.location
                          FROM phpu_tool_objectfs_objects o ),
                      cte_obj_files AS (
                        SELECT f.contenthash, MAX(f.filesize) AS filesize
                          FROM phpu_files f
                     LEFT JOIN cte_objects co ON f.contenthash = co.contenthash
                         WHERE filesize > 0 AND ( co.location = ? OR co.location IS NULL )
                      GROUP BY f.contenthash, f.filesize)
                   SELECT COALESCE(COUNT(cof.contenthash),0) AS objectcount,
                          COALESCE(SUM(cof.filesize),0) AS objectsum
                     FROM cte_obj_files cof
[array (
  0 => 0,
)])

/var/www/site/lib/dml/moodle_database.php:494
/var/www/site/lib/dml/moodle_read_slave_trait.php:317
/var/www/site/lib/dml/mysqli_native_moodle_database.php:1305
/var/www/site/lib/dml/moodle_database.php:1679
/var/www/site/admin/tool/objectfs/classes/local/report/location_report_builder.php:93
/var/www/site/admin/tool/objectfs/classes/local/report/objectfs_report.php:140
/var/www/site/admin/tool/objectfs/tests/local/report/object_status_test.php:48
/var/www/site/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///var/www/site/vendor/phpunit/phpunit/phpunit:97
Dominant language
PHP
Stars
102
Forks
85
Avg merge
4d 21h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from catalyst/moodle-tool_objectfs

All issues in catalyst/moodle-tool_objectfs

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.