From bc96768c697b1fa2bc752589a1166d8376dd7623 Mon Sep 17 00:00:00 2001 From: MuPp3t33r <67326198+MuPp3t33r@users.noreply.github.com> Date: Fri, 22 Aug 2025 07:50:28 +0200 Subject: [PATCH] fix: Update sync_users (#58) * fix: Update sync_users fix issue during "sync credentials.core_user to openedx.auth_user" ERROR 1292 (22007) at line 1: Truncated incorrect DOUBLE value: 'FirstName' MySQL does not use + to concatenate strings, so it was treated as a math equation instead. --- changelog.d/fix-mysql-concat.md | 2 ++ tutorcredentials/templates/credentials/tasks/mysql/sync_users | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fix-mysql-concat.md diff --git a/changelog.d/fix-mysql-concat.md b/changelog.d/fix-mysql-concat.md new file mode 100644 index 0000000..e0f84dc --- /dev/null +++ b/changelog.d/fix-mysql-concat.md @@ -0,0 +1,2 @@ +- [Bugfix] Fixed an issue when syncing `credentials.core_user` to `openedx.auth_user` where the `full_name` field population failed with `ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'FirstName'`. + MySQL does not support string concatenation with `+`, so it was incorrectly treated as a numeric operation. Updated to use `CONCAT()` for proper string concatenation. diff --git a/tutorcredentials/templates/credentials/tasks/mysql/sync_users b/tutorcredentials/templates/credentials/tasks/mysql/sync_users index d4779ac..a4e699a 100644 --- a/tutorcredentials/templates/credentials/tasks/mysql/sync_users +++ b/tutorcredentials/templates/credentials/tasks/mysql/sync_users @@ -11,7 +11,7 @@ INSERT {{ CREDENTIALS_MYSQL_DATABASE }}.core_user (password, last_login, is_supe lms_user.is_staff, \ lms_user.is_active, \ lms_user.date_joined, \ - CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE lms_user.first_name + ' ' + lms_user.last_name END as full_name, \ + CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE CONCAT(lms_user.first_name, ' ', lms_user.last_name) END as full_name, \ lms_user.id as lms_user_id \ FROM {{ OPENEDX_MYSQL_DATABASE }}.auth_user lms_user \ LEFT JOIN {{ OPENEDX_MYSQL_DATABASE }}.auth_userprofile as lms_profile ON (lms_user.id = lms_profile.user_id) \