4 Commits
Author SHA1 Message Date
ulleo 337c75549b fix(chat): constrain SQL row-limit placement to outermost query in prompt templates (#1202)
The row-limit policy in query_limit/no_query_limit did not specify WHERE
the limit should be applied, so LLMs could put LIMIT/ROWNUM/TOP inside
subqueries, truncating the data feeding aggregation (limiting accessed
rows instead of the final result set).

- query_limit/no_query_limit: limit must be applied only to the outermost
  query; never inside subqueries, derived tables or CTEs; add conditional
  per-group top-N note (window functions where supported)
- process_check (template.yaml + Oracle override): step 4 now verifies
  limit placement
- sql_examples: add nested-aggregation bad/good examples for all 11
  engines showing the limit on the outer query only
- Oracle: fix invalid GROUP BY...WHERE ROWNUM example and wrong
  ROWNUM-before-ORDER BY few-shot answers (wrap with outer query)
2026-09-21 14:50:55 +08:00
ulleo c6403fae78 feat: improve SQL template 2025-12-16 18:57:14 +08:00
ulleo e8bdb72a4e feat: improve generate sql template 2025-10-22 16:00:02 +08:00
ulleo 55fb063f6e feat: improve generate sql template
1.Add parameter: GENERATE_SQL_QUERY_LIMIT_ENABLED (default value is True to control data return Limit 1000 rows)
2.Use different SQL example templates based on different data sources.
2025-10-15 18:34:47 +08:00