The issue involves PostgreSQL-specific behavior with custom DocTypes and schema synchronization.
The issue involves PostgreSQL-specific behavior where `frappe.get_meta(custom_doctype).has_field("name")` returns `False` for custom DocTypes, causing downstream errors in `frappe.get_list`. Additionally, schema synchronization fails to populate `search_fields` correctly. The problem is specific to custom DocTypes and PostgreSQL, requiring investigation into schema handling and metadata management.
frappe.get_meta(custom_doctype).has_field("name") consistently returns False for custom DocTypes defined in apps when using PostgreSQL. This prevents filtering/searching by the name field and causes a downstream AttributeError: 'list' object has no attribute 'lower' in DatabaseQuery.sanitize_fields when using frappe.get_list with certain filters (e.g., OR conditions).
Additionally, the schema synchronization process (bench migrate or bench reload-doctype) fails to populate the search_fields column in the tabDocType table based on the in_global_search flags set on fields within the DocType definition JSON and tabDocField table.
The issue appears specific to custom DocTypes, as standard Frappe DocTypes (e.g., "User", "ToDo") correctly return True for meta.has_field("name"). The problem persists even after simplifying the custom DocType definition to a minimal structure and running bench update --reset.
Output of bench version
firebase admin initialized successfully!
frappe 15.67.0
frappe_s3_attachment 0.0.1
frappe_types 0.0.1
nirmaan_crm 0.0.1
nirmaan_stack 0.0.1
Database: PostgreSQL 14.11 (Debian package 14.11-1.pgdg120+2)
Environment: Running via official Frappe Docker images (likely frappe/frappe-worker, frappe/frappe-nginx, postgres:14)
bench new-app my_app).bench --site localhost install-app my_app).my_app/doctype/test_item/test_item.json):
{
"doctype": "DocType",
"name": "Test Item",
"module": "My App",
"engine": "InnoDB",
"naming_rule": "By fieldname",
"autoname": "item_code",
"fields": [
{
"fie
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!