mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-18 10:57:56 +00:00
ci(greptile): widen guide scope to SQL-bearing non-Python files; fix HAVING-alias wording
Address Greptile review: - customContext.files scope was **/*.py only, so Query Report SQL in .js/.sql/report .json files didn't get the guide attached as context (the global instructions still applied). Widen to .py/.js/.sql/report **/*.json. - The guide's HAVING-alias rule said "with no GROUP BY"; PostgreSQL rejects a SELECT-alias in HAVING regardless of GROUP BY. Reworded to match (repeat the expression, or move a non-aggregate predicate to WHERE).
This commit is contained in:
5
.github/POSTGRES_COMPATIBILITY.md
vendored
5
.github/POSTGRES_COMPATIBILITY.md
vendored
@@ -39,8 +39,9 @@ Flag a changed query that uses any of these:
|
|||||||
`frappe.query_builder.functions` equivalents (`CombineDatetime`, `DateDiff`, `Case`,
|
`frappe.query_builder.functions` equivalents (`CombineDatetime`, `DateDiff`, `Case`,
|
||||||
`GroupConcat`, …) or a precomputed column (e.g. `posting_datetime`).
|
`GroupConcat`, …) or a precomputed column (e.g. `posting_datetime`).
|
||||||
- **`UPDATE … JOIN`** — not valid on PostgreSQL. Rewrite as `UPDATE … WHERE name IN (subquery)`.
|
- **`UPDATE … JOIN`** — not valid on PostgreSQL. Rewrite as `UPDATE … WHERE name IN (subquery)`.
|
||||||
- **`HAVING` referencing a `SELECT` alias** with no `GROUP BY` — move the predicate into `WHERE`
|
- **`HAVING` referencing a `SELECT` alias** — PostgreSQL rejects output-column aliases in
|
||||||
on the underlying expression.
|
`HAVING` (regardless of whether the query has a `GROUP BY`; MariaDB allows them). Repeat the
|
||||||
|
underlying expression in `HAVING`, or move a non-aggregate predicate into `WHERE`.
|
||||||
- **`SELECT DISTINCT … ORDER BY <expr not in the select list>`** — add the expr to the select.
|
- **`SELECT DISTINCT … ORDER BY <expr not in the select list>`** — add the expr to the select.
|
||||||
- **Single-quoted column alias** `AS 'x'` — PostgreSQL reads `'x'` as a string literal. Use an
|
- **Single-quoted column alias** `AS 'x'` — PostgreSQL reads `'x'` as a string literal. Use an
|
||||||
unquoted (or double-quoted) alias.
|
unquoted (or double-quoted) alias.
|
||||||
|
|||||||
@@ -12,7 +12,10 @@
|
|||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"scope": [
|
"scope": [
|
||||||
"**/*.py"
|
"**/*.py",
|
||||||
|
"**/*.js",
|
||||||
|
"**/*.sql",
|
||||||
|
"**/report/**/*.json"
|
||||||
],
|
],
|
||||||
"path": ".github/POSTGRES_COMPATIBILITY.md",
|
"path": ".github/POSTGRES_COMPATIBILITY.md",
|
||||||
"description": "MariaDB <-> PostgreSQL parity rules for ERPNext: query constructs that error on PostgreSQL or silently diverge across the two engines, the GROUP BY row-count trap, the false positives not to flag, and the rule that MariaDB output must not change. Apply to every changed database query in this PR."
|
"description": "MariaDB <-> PostgreSQL parity rules for ERPNext: query constructs that error on PostgreSQL or silently diverge across the two engines, the GROUP BY row-count trap, the false positives not to flag, and the rule that MariaDB output must not change. Apply to every changed database query in this PR."
|
||||||
|
|||||||
Reference in New Issue
Block a user