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
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
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
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
Akhil Narang
3881a7ae7e
fix(query): check parent permissions when querying child table fields
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-22 12:48:35 +05:30
Sagar Vora
a13f02a240
Merge pull request #35343 from neox-d/fix-single-doctype-join
2025-12-22 12:27:59 +05:30
Sagar Vora
7ce888d5f1
fix: return early is parent doctype is single
2025-12-22 12:14:17 +05:30
Akhil Narang
5992baeaff
fix(query): respect validate_filters
...
Block dot notation for link field access, and automatic child table detection as well
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-19 19:04:10 +05:30
Akhil Narang
23cdeb7bf5
fix(query): remove redundant check
...
`_check_field_permission` already checks `self.apply_permissions`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-19 19:04:10 +05:30
Akhil Narang
2056071f8e
fix(query): check permissions for backtick quoted fields
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-19 19:04:10 +05:30
Akhil Narang
0d92b8b195
fix(query): validate permissions before join
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-19 19:04:10 +05:30
Abhiraaj R C
584e629c5f
fix: parent table join for child tables of Single DocTypes
2025-12-18 18:50:26 +05:30
Akhil Narang
81f7a247f0
fix(query): track aliases for DynamicTableField as well
...
Child tables, links for example.
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-18 17:26:52 +05:30
Ankush Menat
2505fa9c8c
Merge pull request #35308 from akhilnarang/qb-ifnull-optimization
...
perf: Split ifnull into two conditions
2025-12-18 10:31:30 +05:30
Sagar Vora
d1ffd99fe8
fix(query): wrap CombinedRawCriterion in parentheses for correct precedence
...
Without proper grouping, OR conditions from shared docs could bypass WHERE filters:
WHERE filter=X AND perm_cond OR shared_cond -- shared_cond ignores filter!
With proper grouping:
WHERE filter=X AND (perm_cond OR shared_cond) -- correct behavior
2025-12-17 22:28:52 +05:30
Sagar Vora
c7e9e01eb8
chore: fix linter issues
2025-12-17 19:04:00 +05:30
Sagar Vora
591d9a3535
fix: update logic for child tables
2025-12-17 19:03:15 +05:30
Ankush Menat
7be9fec036
perf: Split ifnull into two conditions
...
This produces better query plan with index intersection using 2
conditions instead of fulltable scan on dumb condition
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-17 17:47:08 +05:30
Sagar Vora
2b822cc63f
refactor(query): simplify permission logic in add_permission_conditions
...
- Extract _raise_permission_error helper for reuse
- Simplify get_user_permission_conditions to return list[Criterion]
- Rewrite add_permission_conditions to match documented logic:
- No role perms → apply only share permissions
- Role perms → (owner OR user perms) AND query conditions
- Shared docs OR other conditions when applicable
- Move apply_permissions check inside add_permission_conditions
2025-12-17 15:59:37 +05:30
Akhil Narang
54a0081cf3
fix(query): use AND if adding shared query
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-16 17:11:09 +05:30
Akhil Narang
c7f5ea837a
feat: implement field masking for query builder ( #35230 )
...
* feat: implement field masking for query builder
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix: add series and sessions to "core doctypes" list
This is so that we don't try to query their meta
This should also resolve #35030
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
---------
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-16 12:08:13 +05:30