From 12efd72cc973fb2a4319709470b853b8fea4a34b Mon Sep 17 00:00:00 2001 From: Tai Cai Date: Wed, 24 Dec 2025 11:33:42 +0700 Subject: [PATCH] fix(model): fix postgres compatibility in update_user_settings In Postgres, double quotes denote identifiers. The previous LIKE clause format caused "UndefinedColumn" errors during field renaming (e.g., during HRMS installation) because the pattern was interpreted as a column name. This change parameterizes the LIKE pattern and passes the wildcarded value as a bound parameter, ensuring compatibility with both MySQL and Postgres. --- frappe/model/utils/rename_field.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/model/utils/rename_field.py b/frappe/model/utils/rename_field.py index d826a25576..55f8a7f33c 100644 --- a/frappe/model/utils/rename_field.py +++ b/frappe/model/utils/rename_field.py @@ -166,9 +166,9 @@ def update_user_settings(doctype, old_fieldname, new_fieldname): sync_user_settings() user_settings = frappe.db.sql( - ''' select user, doctype, data from `__UserSettings` - where doctype=%s and data like "%%%s%%"''', - (doctype, old_fieldname), + """ select user, doctype, data from `__UserSettings` + where doctype=%s and data like %s""", + (doctype, f"%{old_fieldname}%"), as_dict=1, )