You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2026/04/18 21:00:00 UTC

[jira] [Updated] (GROOVY-9701) ExtractIndexAndSql does not recognize double-quoted SQL identifiers

     [ https://issues.apache.org/jira/browse/GROOVY-9701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King updated GROOVY-9701:
------------------------------
    Summary: ExtractIndexAndSql does not recognize double-quoted SQL identifiers  (was: Groovy Sql , Does not excute SQL query , If there are odd numbers of single quotes in the query)

> ExtractIndexAndSql does not recognize double-quoted SQL identifiers
> -------------------------------------------------------------------
>
>                 Key: GROOVY-9701
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9701
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime, SQL processing
>    Affects Versions: 2.5.10
>            Reporter: shri
>            Assignee: Paul King
>            Priority: Minor
>
> In versions of Groovy since 2.5.10 when Groovy SQL prepares to execute a query, it checks the query SQL for unterminated single quotes (line 145 of [groovy.sql|https://www.codota.com/code/java/packages/groovy.sql].*ExtractIndexAndSql*).
> This results into behavior : If query string  has odd numbers of single quotes it will fail with error IllegalStateException("Failed to process query. Unterminated ' character?"
> Example :  select  'NAME' =str_replace(str_replace,name ,'"', null ),"'", null) from Addresss.
> Here there are 5 single quotes so the query will fail.
> There is a quick solution as well 
> Try and match odd single quotes with even quotes.
> example :select  'NAME' =str_replace(str_replace,name ,'"', null ),"'", null)  --'



--
This message was sent by Atlassian Jira
(v8.20.10#820010)