Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9295

Sql.checkForNamedParams false positives

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.4.15
    • None
    • SQL processing
    • None
    • Grails 3.2.4

    Description

      The public function 

      {{checkForNamedParams }}

      (used in getPreparedStatement)  detects named parameters with a regex via

      ExtractIndexAndSql.hasNamedParameters

      This regex matches not only named params (:xxx) but also sql casts ('xxx'::text) which in turn results in sql errrs when called with

      sql.eachRow(query, args, closure)

       

      {{when }}

      {{a. query includes a cast but no named parameters and }}

      b. args contains  Map with named parameters

      Test case:

      sql.eachRow("select 1,2,3::text", ["a": "b"], {{{

      { row -> println row as String}

      )}}

      error when sql points to postgres: no hstore extension installed

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            senior.weber@gmail.com Andreas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: