Commit graph

1124 commits

Author SHA1 Message Date
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
Akhil Narang
62b4700395
feat(multisql): support passing a wildcard query
Otherwise we sometimes duplicate a query for different DBs

Resolves #35768

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-08 18:52:01 +05:30
Akhil Narang
c2e2ca611a
fix(query): handle string argument with between
Prevents crash when filter value doesn't exist (example, invalid Fiscal Year)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-08 16:34:27 +05:30
Akhil Narang
fb07cf7579
fix(query): don't crash for invalid value
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-08 16:33:40 +05:30
AarDG10
54da011c65 fix(query): check hooks for custom_operator definition 2026-01-07 20:42:24 +05:30
Akhil Narang
d02d89436e
fix(qb): support reportview alias format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-06 19:30:14 +05:30
Sagar Vora
9a774de21e
fix: add permission conditions to where clause instead of join 2026-01-05 13:32:04 +00:00
ili.ad
261e78e492
fix(postgres): drop_index_if_exists uses DROP INDEX IF EXISTS (#35636)
* fix(postgres): drop_index_if_exists uses DROP INDEX IF EXISTS

* fix(linting): apply pre-commit to code

---------

Co-authored-by: Matt Howard <github.severity519@passmail.net>
Co-authored-by: AarDG10 <aarol.dsouza@gmail.com>
2026-01-05 11:15:41 +00:00
Akhil Narang
0661fa3f60
Merge pull request #35538 from akhilnarang/ignore-filter-fifth-parameter
fix(query): ignore 5th filter parameter
2025-12-30 17:59:42 +05:30
Akhil Narang
92900d366c
refactor: simplify code using match
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-30 16:54:59 +05:30
Akhil Narang
038bd44d08
fix(query): ignore 5th filter parameter
It doesn't do anything, but many old charts, etc. still have it present, no point erroring out.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-30 16:30:42 +05:30
Sagar Vora
e6f867da74
Merge pull request #35391 from akhilnarang/qb-fixes 2025-12-30 13:44:43 +05:30
Sagar Vora
c9147fb840 chore: improve docstring 2025-12-30 13:25:13 +05:30
Sagar Vora
9fd5106ad1 fix: specify correct doctype in _raise_permission_error 2025-12-30 13:21:49 +05:30
Sagar Vora
26b3e6363e chore: deprecate validate_filters 2025-12-30 13:02:49 +05:30
Aarol D'Souza
799123c341
perf(postgres): skip unnecessary migrations due to type mismatch (#34784) 2025-12-29 18:29:22 +05:30
Sagar Vora
0a76f1fc36
Merge branch 'develop' into qb-fixes 2025-12-29 15:43:32 +05:30
artykbasar
2739385184
fix(estimate_count): scope to site db (#35481)
* Fix large-table heuristics: scope estimate_count and guard recency

* fix(estimate_count): scope to site database

Incase some setups don't have per-db-users

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: artykbasar <artykbasar@users.noreply.github.com>
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2025-12-29 14:11:34 +05:30
Aarol D'Souza
48c8ee9a78
feat(postgres): add unbuffered cursor in postgres (#35016)
* feat(postgres): add unbuffered cursor in postgres

* test: add unbuffered_cursor test for Postgres
2025-12-23 17:21:28 +05:30