mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-11 13:41:47 +00:00
fix(projects): drop redundant distinct from portal project list (Postgres ordering) (#56362)
get_project_list builds a single-table query (no joins) with fields="*", which always selects the unique PK `name`, so distinct=True can never deduplicate any rows. It is a no-op on the result set for both engines. It is not a no-op on ordering, though: frappe.db drops the ORDER BY clause for distinct queries on Postgres (Postgres requires every ORDER BY term to appear in the select list under DISTINCT), so the website project list came back unordered on Postgres while MariaDB returned it ordered by `order_by`. Removing the redundant flag leaves the MariaDB result and order untouched and restores the same ordering on Postgres.
This commit is contained in:
@@ -486,6 +486,8 @@ def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20, o
|
||||
else:
|
||||
filters.append([doctype, "name", "like", "%" + txt + "%"])
|
||||
|
||||
# No distinct=True: it never dedupes here (single table, fields="*" carries PK `name`) but makes
|
||||
# frappe drop ORDER BY on Postgres, leaving the portal list unordered there.
|
||||
return frappe.get_list(
|
||||
doctype,
|
||||
fields="*",
|
||||
@@ -495,7 +497,6 @@ def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20, o
|
||||
limit_page_length=limit_page_length,
|
||||
order_by=order_by,
|
||||
ignore_permissions=ignore_permissions,
|
||||
distinct=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user