From b73aac38f4bbfccc271e76d43d019a3664d0c4f3 Mon Sep 17 00:00:00 2001 From: qinling0210 <88864212+qinling0210@users.noreply.github.com> Date: Wed, 12 Aug 2026 10:59:22 +0800 Subject: [PATCH] Update infinity json_extract_string usage (#18139) ### Summary Update infinity json_extract_string usage. Example: json_extract_string(chunk_data, '$.name') LIKE '%Alice%' --- api/db/services/dialog_service.py | 4 ++-- internal/service/chat_pipeline.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 79ef4bc1c9..a7ded8e8f1 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -1141,8 +1141,8 @@ RULES: - Question mentions "not null" or "excluding null" - Add NULL check for count specific column - DO NOT add NULL check for COUNT(*) queries (COUNT(*) counts all rows including nulls) -7. json_extract_string() returns JSON-quoted strings ("value"), so WHERE comparisons MUST wrap values in double-quotes inside single-quotes (no spaces between quotes): '"value"' (e.g. WHERE json_extract_string(chunk_data, '$.name') = '"Alice"') -8. For partial text search, use LIKE with wildcards: '"%value%"' (e.g. WHERE json_extract_string(chunk_data, '$.name') LIKE '"%Alice%"') +7. json_extract_string() returns plain (unquoted) strings, so WHERE comparisons use plain single-quoted values: 'value' (e.g. WHERE json_extract_string(chunk_data, '$.name') = 'Alice') +8. For partial text search, use LIKE with wildcards: '%value%' (e.g. WHERE json_extract_string(chunk_data, '$.name') LIKE '%Alice%') 9. Output ONLY the SQL, no explanations""" user_prompt = """Table: {} Fields (EXACT case): {} diff --git a/internal/service/chat_pipeline.go b/internal/service/chat_pipeline.go index 29d46142e9..f029701a8c 100644 --- a/internal/service/chat_pipeline.go +++ b/internal/service/chat_pipeline.go @@ -2966,8 +2966,8 @@ RULES: - Question mentions "not null" or "excluding null" - Add NULL check for count specific column - DO NOT add NULL check for COUNT(*) queries (COUNT(*) counts all rows including nulls) -7. json_extract_string() returns JSON-quoted strings ("value"), so WHERE comparisons MUST wrap values in double-quotes inside single-quotes (no spaces between quotes): '"value"' (e.g. WHERE json_extract_string(chunk_data, '$.name') = '"Alice"') -8. For partial text search, use LIKE with wildcards: '"%value%"' (e.g. WHERE json_extract_string(chunk_data, '$.name') LIKE '"%Alice%"') +7. json_extract_string() returns plain (unquoted) strings, so WHERE comparisons use plain single-quoted values: 'value' (e.g. WHERE json_extract_string(chunk_data, '$.name') = 'Alice') +8. For partial text search, use LIKE with wildcards: '%value%' (e.g. WHERE json_extract_string(chunk_data, '$.name') LIKE '%Alice%') 9. Output ONLY the SQL, no explanations` // infinitySQLUserPromptTemplate has 4 %s placeholders: