Couple of improvements

This commit is contained in:
Miroslav Štampar 2026-06-18 17:46:40 +02:00
parent 8a458fc8d0
commit 8de9c5899d
18 changed files with 108 additions and 51 deletions

View file

@ -326,8 +326,10 @@ def errorUse(expression, dump=False):
expression, limitCond, topLimit, startLimit, stopLimit = agent.limitCondition(expression, dump)
if limitCond:
# Count the number of SQL query entries output
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % ('*' if len(expressionFieldsList) > 1 else expressionFields), 1)
# Count the number of SQL query entries output. NOTE: always COUNT(*) (row count); a single
# field must NOT use COUNT(field) as that excludes NULLs and would drop NULL-valued rows from
# the dump (e.g. a column whose value is NULL on some rows).
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % '*', 1)
if " ORDER BY " in countedExpression.upper():
_ = countedExpression.upper().rindex(" ORDER BY ")