You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/04/18 12:21:57 UTC

(groovy) 01/03: GROOVY-9295: Sql.checkForNamedParams false positives

This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 416cd9072998e2f6fa289f80ce4237099a0074cc
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Apr 18 22:14:29 2026 +1000

    GROOVY-9295: Sql.checkForNamedParams false positives
---
 .../src/test/groovy/groovy/sql/ExtractIndexAndSqlTest.groovy     | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/subprojects/groovy-sql/src/test/groovy/groovy/sql/ExtractIndexAndSqlTest.groovy b/subprojects/groovy-sql/src/test/groovy/groovy/sql/ExtractIndexAndSqlTest.groovy
index 5830ee09fe..cb2503b230 100644
--- a/subprojects/groovy-sql/src/test/groovy/groovy/sql/ExtractIndexAndSqlTest.groovy
+++ b/subprojects/groovy-sql/src/test/groovy/groovy/sql/ExtractIndexAndSqlTest.groovy
@@ -233,6 +233,15 @@ and 3 = (12 / 4)
         assert !ExtractIndexAndSql.hasNamedParameters("select * from TABLE where TEXTFIELD::integer = 3")
     }
 
+    // GROOVY-9295
+    @Test
+    void testCastingWithoutSpacesNotConfusedWithNamedParameters() {
+        assert !ExtractIndexAndSql.hasNamedParameters("select 1,2,3::text")
+        String query = "select 1,2,3::text"
+        assert query == ExtractIndexAndSql.from(query).newSql
+        assert ExtractIndexAndSql.from(query).indexPropList.isEmpty()
+    }
+
     @Test
     void testGROOVY6625() {
         String query = """SELECT