Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-4791

Bypass lookup function's keycolumn reserved word

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 9.3, 9.2.1, 9.1.4
    • 8.12.x
    • Query Engine
    • None
    • Hide

      1 - Create a reference data table that has a column with literal name of "value"
      2 - Use the LOOKUP function with the "value" column in the keyColumn field (3rd argument)

      Show
      1 - Create a reference data table that has a column with literal name of "value" 2 - Use the LOOKUP function with the "value" column in the keyColumn field (3rd argument)

      When using the Teiid LOOKUP function, the 3rd argument is to specify the keycolumn. In my table, the column I want to reference is literally named "value", which is a SQL reserved word. The generated query chokes on this because it's not expecting a reserved word to be here when parsing the grammar. I've tried quoting and escaping to get around this, but nothing seems to work.

      21:18:55,860 WARN  [org.teiid.PROCESSOR] (Worker16_QueryProcessorQueue167) TEIID30020 Processing exception for request NLkytVFPLOM6.0 'TEIID30328 Unable to evaluate lookup('tdsa_vbl.t_code_translate', 'descr', 'value', 'NAMS'): TEIID31100 Parsing error: Encountered "SELECT [*]VALUE[*] ,DESCR" at line 1, column 8.
      Was expecting: "char" | "date" | "time" | "timestamp" | "cast" | "convert" | "all" | "any" | "array_agg" | "case" ...'. Originally ExpressionEvaluationException QueryParser.java:214. Enable more detailed logging to see the entire stacktrace.
      21:19:13,077 WARN  [org.teiid.PROCESSOR] (Worker16_QueryProcessorQueue168) TEIID30020 Processing exception for request /qqhN3vx+au1.0 'TEIID31118 Element "tdsa_vbl.t_code_translate."[value]"" is not defined by any relevant group.'. Originally QueryResolverException ResolverVisitor.java:106. Enable more detailed logging to see the entire stacktrace.
      21:19:40,897 WARN  [org.teiid.PROCESSOR] (Worker16_QueryProcessorQueue169) TEIID30020 Processing exception for request 1TAniWpe2wpN.0 'TEIID31119 Symbol "'value'" is specified with an unknown group context'. Originally QueryResolverException ResolverVisitor.java:106. Enable more detailed logging to see the entire stacktrace.
      21:19:52,600 WARN  [org.teiid.PROCESSOR] (Worker16_QueryProcessorQueue170) TEIID30020 Processing exception for request +8tCacHlFS8D.0 'TEIID31119 Symbol "value" is specified with an unknown group context'. Originally QueryResolverException ResolverVisitor.java:106. Enable more detailed logging to see the entire stacktrace.
      

            rhn-engineering-shawkins Steven Hawkins
            stran@redhat.com Steve Tran
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: