moosh
moosh copied to clipboard
category-create fails with "Comparisons of text column conditions are not allowed"
- moosh version: moosh_moodle41_2023010400
- moodle version: 4.1
- database: MySQL
- php version:
- operating system: MacOS host / Bitnami Moodle container
Actual behaviour
Creating a category if doesn't exist, return ID otherwise, fails:
MAIN_CAT=$(moosh category-create -r -p 0 -v 1 -d "Test" test | tail -n 1)
logs error:
[31-May-2023 02:18:17 UTC] Default exception handler: Comparisons of text column conditions are not allowed. Please use sql_compare_text() in your query. Debug:
Error code: textconditionsnotallowed
* line 685 of /lib/dml/moodle_database.php: dml_exception thrown
* line 1458 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
* line 66 of /opt/moosh/Moosh/Command/Moodle39/Category/CategoryCreate.php: call to moodle_database->get_records()
* line 41 of /opt/moosh/Moosh/Command/Moodle39/Category/CategoryCreate.php: call to Moosh\Command\Moodle39\Category\CategoryCreate->find_category()
* line 364 of /opt/moosh/moosh.php: call to Moosh\Command\Moodle39\Category\CategoryCreate->execute()
Expected behaviour
Returns the ID of the created OR existing category
Steps to reproduce
I would guess simply running moosh category-create -r -p 0 -v 1 -d "Test" test should reproduce.
The error was mentioned here as a wont-fix wrt Moodle DB library: https://moodle.org/mod/forum/discuss.php?d=263229