People ususally write queries like these...
```
frappe.get_all(doctype, {"name": ("in", list_of_docs))
```
Ocassionally, the `list_of_docs` is empty because it's dynamically
generated and in this case we end up doing full table scan to find... nothing!
* fix: Remove incorrect fallback
If you do +1 on date it will also start considering next date. This was
only done to accomodate date filter on datetime fields. Which also
doesn't really work.
* refactor: simplify fieldtype detection
* fix!: Correct datetime fallbacks for between filters
* chore: remove unncessary test
This is very specific and introduces flake when the job tests run before
it.
- Kinda confuses query planner (idk why it's not smart enough to
understand but there are probably edge cases where it can't be done)
- `null != null` and `'' != null` both yield `null` which is falsy and
won't be shown in results.
Alternate fix to https://github.com/frappe/frappe/pull/21817
We eagerly fetch shared documents for ANY `get_list` query, even when
user has full read acess doctype, where it's moot to consider adding
shared document as separately.
This eliminates one entire db call from get_list and in most cases
get_list will translate to single DB call, hence probably worth the
additional complexity.
* fix(db_query): Don't track link_tables separately
Treat all joined tables the same, expand the fieldnames whether Table or
Link type with their respective table names
* fix(db_query): Add link join conditions for all relevant fields
* Revert "fix(db_query): Add link join conditions for all relevant fields"
This reverts commit 79622ab4cea5aa73a24f4ba7afde8e83510a79fb.
* Revert "fix(db_query): Don't track link_tables separately"
This reverts commit b8364f781e52e7ffaa7faa8878ef409b023f2288.
* fix: Check link field tables permissions in permlevel checks
* test: Fix, add for test_permlevel_fields
Previous assertion was wrong :')
added extra to check if access is fine
* fix(db_query): Allow link field to have 'tab'
Issue: Occurence of tab was used to check if the selected field is a table name
and not a fieldname. This caused DocTypes with fields like `tablets` or
`table_name` to break List Views.
Change: Check if the field exists in meta to be sure that the selectable
is a field.
* fix: Split once to ensure at most 2 args
* Util get_permitted_fields checks for valid columns instead of planned logic
* Remove virtual field from dict if not in permitted fields
* Remove reliance on sentinel object _DOC_DELETED_ATTR