Commit graph

1142 commits

Author SHA1 Message Date
AarDG10
fd2661160e fix(query): always alias the table when used in joins 2026-04-28 17:52:20 +05:30
vijayanrxbb
383b24e0f9 fix(db_query): unique alias on self-referential Link joins
When a DocType has two or more Link fields pointing back to itself and
list view tries to join them, pypika auto-aliased both joins with the
same '<table>2' suffix, producing a MySQL 1066 'Not unique table/alias'
error.

Alias each self-referential join with 'tab<doctype>_<link_fieldname>'
so every join gets a unique alias, and use the same aliased table in
apply_select so SELECT references resolve correctly.
2026-04-25 12:42:57 +05:30
rohitwaghchaure
2b1e30384f
Merge pull request #38561 from rohitwaghchaure/fix-max_writes_per_transaction
feat: provision to configure max_writes_per_transaction in site config
2026-04-14 15:26:00 +05:30
Rohit Waghchaure
683019f296 feat: provision to configure max_writes_per_transaction in site config 2026-04-13 16:31:05 +05:30
Kaushal Shriwas
51cfc8181e
perf(query): replace Coalesce with OR IS NULL in func_in (#38336) 2026-04-08 10:57:07 +05:30
diptanilsaha
6d12ae7a40
docs(schema): fixed SPECIAL_CHAR_PATTERN constant definition string (#38433) 2026-04-06 15:52:32 +00:00
Hussain Nagaria
ac3d5ee115
Merge pull request #38128 from kaulith/fix/qb-in-filter-none-handling 2026-03-27 18:12:11 +05:30
Ejaaz Khan
ada4df8f0f
Merge pull request #38282 from iamejaaz/sticky-header
feat: sticky header on list view
2026-03-27 00:32:14 +05:30
Ejaaz Khan
21a2dd5057 fix: precommit errors of parenthesized 2026-03-27 00:15:31 +05:30
Sagar Vora
17f9ca9819 fix: check for numeric arg first 2026-03-26 17:25:13 +05:30
Sagar Vora
0d415afdd5 fix: allow unicode chars in field regexes 2026-03-26 17:02:12 +05:30
Kaushal Shriwas
19a6c5aa50 fix(query): handle none in IN filter value list via Coalesce 2026-03-18 16:57:49 +05:30
Priyal
d6fdcdb832 refactor: update permission check method 2026-03-17 18:17:38 +05:30
Priyal
aef4d4bfc3 fix: check only select perm instead of read or select 2026-03-17 18:17:38 +05:30
Akhil Narang
e2fe249706
Merge pull request #37903 from akhilnarang/qb-fixes
fix: some follow up fixes for query builder
2026-03-13 13:36:48 +05:30
Akhil Narang
72007f636d
fix(query): ensure atleast name is always selected
Otherwise we got an empty query if we tried to only query a child table

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-13 10:23:27 +05:30
Akhil Narang
a084bad5d5
fix(apply_field_permissions): improve checks
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-13 10:23:27 +05:30
KerollesFathy
78ae8d9b52 fix: cstr value in func_is to avoid AttributeError 2026-03-11 14:15:14 +00:00
Sagar Vora
7a113c0aee
fix: use correct core doctypes set in _get_filterable_fields (#37932) 2026-03-11 17:19:48 +05:30
Akhil Narang
3e4f139ff3
fix: use string representation of exceptions in translated strings (#37756)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-03-06 13:02:16 +05:30
Suraj Shetty
0c211aa4a0
Merge pull request #35940 from AarDG10/fix-orderby-pg 2026-02-22 13:09:43 +05:30
Sagar Vora
95283be9f5
Merge pull request #37316 from sagarvora/fix/select-permission-filter-fields
fix: allow filtering by all permlevel 0 fields with select permission
2026-02-20 21:34:06 +05:30
Sagar Vora
369f15ac09 fix: allow filtering by all permlevel 0 fields with select permission
Users with only 'select' permission can now filter, order by, and
group by all permlevel 0 fields, not just search fields.

- Added _get_filterable_fields() returning all permlevel 0 fields
  for select permission users
- Split permission checking into check_select_field_permission()
  and check_filter_field_permission()
- select field validation uses check_select_field_permission
- Filter/order/group by validation uses check_filter_field_permission
2026-02-20 21:23:29 +05:30
Shllokkk
16e6c40d70
fix(schema): drop unique constraint for deleted doctype fields (#36356)
* fix(schema): drop unique constraint and indexes for deleted doctype fields

* refactor(schema): rename a variable and remove commented code

* test: add test case for dropping unique constraint on field deletion from doctype

* fix(tests): prevent list mutation during iteration

* test(db): guard MariaDB-specific unique index test with db_type_is.MARIADB

* fix(schema): drop unique constraints and indexes for deleted fields on postgres

* fix(schema): make postgres unique cleanup idempotent for deleted fields

* fix(schema): make postgres unique cleanup idempotent on reload

* test: add test case for dropping unique constraint and index on field deletion for postgres

* fix(schema): make postgres unique cleanup idempotent
2026-02-20 20:15:32 +05:30
Aarol D'Souza
a043c26709
Merge pull request #35318 from AarDG10/add-custom-hook
feat(server script): parse child table list onto server script for customizations
2026-02-17 23:05:32 +05:30
Prathamesh Kurunkar
69e655d08b
fix(db): support list of fields in get_value method when cache is True (#37050)
* fix(db): support list of fields in get_value method when cache is True

* test(db): ensure cache hit does not execute db query
2026-02-16 20:28:38 +05:30
Ankush Menat
251a081e85
fix: Log timeout and deadlocks (#36786)
closes https://github.com/frappe/frappe/issues/34254
2026-02-16 12:12:05 +05:30
Diptanil Saha
a93b84df3c
fix(query_builder): added validation to check DocType name (#36878)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2026-02-09 15:24:58 +05:30
Suraj Shetty
cefac6851e
Merge pull request #36621 from frappe/fix-empty-list-in-operator-behavior
fix!: Enhance IN/NOT IN operator handling for empty lists
2026-02-09 15:17:54 +05:30
AarDG10
7d31c299eb refactor: minor refactors 2026-02-06 22:11:34 +05:30
Ankush Menat
9fc1787a18
fix: make default flags same on both connectors (#36697) 2026-02-04 12:45:35 +00:00
Sumit Jain
c6868b11c6 feat: Enhance IN/NOT IN operator handling for empty lists
Added logic to return appropriate criteria for empty lists in IN and NOT IN operators. An empty list with IN now returns 0 results (1=0), while NOT IN returns all results (1=1). Updated tests to verify this behavior.
2026-02-03 12:31:29 +05:30
Akhil Narang
3d66341ee2
feat(qb): implement build_match_conditions, build_filter_conditions (#35857)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-02-03 12:10:38 +05:30
Aarol D'Souza
a74725f826
Merge branch 'develop' into add-custom-hook 2026-01-30 23:32:46 +05:30
AarDG10
edd15715b6 feat(query): parse child tables via query file too 2026-01-30 23:25:26 +05:30
Ankush Menat
3cb6602704
fix!: Only query single for single doctypes (#36519)
Right now, if `None` is passed as second arguement we automatically
query singles, in 99% cases this just results in `None` with extra
steps... But why do that?

Better to terminate query early and return nothing if `pk==null` is
requested.
2026-01-30 11:22:17 +00:00
Ankush Menat
fa45415086
fix!: Remove weird fallback to tabSingles (#36517)
This doesn't make any sense.
2026-01-30 11:10:18 +00:00
Aarol D'Souza
95450c85bd chore: resolve conflicts 2026-01-27 19:57:50 +05:30
AarDG10
5c31a7d020 refactor: better variable naming 2026-01-22 10:50:20 +05:30
AarDG10
0654de7e98 fix(query): fix ifnull fallback in postgres 2026-01-22 00:26:31 +05:30
AarDG10
ab2a9f8134 refactor: reduce unnecessary noise in code 2026-01-15 22:55:52 +05:30
AarDG10
4530996223 revert(validation): revert validation due to breakage in old queries 2026-01-15 22:35:39 +05:30
AarDG10
c35f271144 refactor: perform validation only once 2026-01-15 22:21:00 +05:30
AarDG10
151fc37fbd fix(validation): maintain compatibility with different way of writing queries 2026-01-15 19:02:05 +05:30
AarDG10
66c870d730 feat(dx): add validation to check if selected fields are grouped or aggregated for a better dev experience 2026-01-15 18:11:32 +05:30
AarDG10
92e0a215b0 refactor: better naming for tracking grouped fields 2026-01-15 12:59:49 +05:30
AarDG10
fd5da930f3 fix(query): ensure aggregate queries without group_by trigger postgres sort normalization 2026-01-14 19:21:24 +05:30
AarDG10
50e675f009 refactor: update warning to apply only to select distinct queries 2026-01-14 18:33:40 +05:30
AarDG10
cb68c2df32 fix(query): aggregate order_field when used with select group_by 2026-01-14 14:14:59 +05:30
Akhil Narang
8c5b5ecec3
Merge pull request #35775 from akhilnarang/multisql-wildcard
feat(multisql): support passing a wildcard query
2026-01-12 12:23:31 +05:30