moodle-tool_mergeusers icon indicating copy to clipboard operation
moodle-tool_mergeusers copied to clipboard

Error when searching with text and "All"

Open tibbakoi opened this issue 5 months ago • 2 comments

When searching using some text and choosing All fields, an invalid syntax type error is displayed. For example with this search I got the following debug info:

image

Debug info: ERROR: invalid input syntax for type bigint: "throwaway" CONTEXT: unnamed portal parameter $1 = '...' SELECT * FROM mdl_user WHERE id = $1 OR username LIKE $2 OR firstname LIKE $3 OR lastname LIKE $4 OR email LIKE $5 OR idnumber LIKE $6 ORDER BY lastname, firstname [array ( 0 => 'throwaway', 1 => '%throwaway%', 2 => '%throwaway%', 3 => '%throwaway%', 4 => '%throwaway%', 5 => '%throwaway%', )] Error code: dmlreadexception

Stack trace: line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end() line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end() line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 136 of /admin/tool/mergeusers/lib/mergeusersearch.php: call to pgsql_native_moodle_database->get_records_sql() line 165 of /admin/tool/mergeusers/index.php: call to MergeUserSearch->search_users()

I presume this is because one of the fields wants a bigint rather than string, as searching All with a number and searching First name with text is successful.

I'm on Moodle 4.1.13 (Build: 20240902), plugin version 2023040402

tibbakoi avatar Sep 27 '24 10:09 tibbakoi