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

TEIID30020 Processing exception for request, "select * into" doesn't work in some cases

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.1, 10.0.4, 10.2
    • Component/s: Query Engine
    • Labels:
      None
    • Environment:

      teiid-10.1.0 on WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final)

    • Steps to Reproduce:
      Hide

      1. Create test_rank and test_rank_copy tables in PostgreSQL using the following script:

      create table test_rank(a integer);
      create table test_rank_copy(expr1 integer);
      

      2. Add postgresql database configuration in standalone-teiid.xml:

      <datasource jndi-name="java:/test_pg" pool-name="test_pg" enabled="true" use-java-context="true">
                          <connection-url>jdbc:postgresql://localhost:5432/test?charSet=utf8</connection-url>
                          <driver-class>org.postgresql.Driver</driver-class>
                          <driver>org.postgresql</driver>
                          <pool>
                              <min-pool-size>2</min-pool-size>
                              <max-pool-size>70</max-pool-size>
                              <prefill>false</prefill>
                              <use-strict-min>false</use-strict-min>
                              <flush-strategy>FailingConnectionOnly</flush-strategy>
                          </pool>
                          <security>
                              <user-name>postgres</user-name>
                              <password>xxxxxx</password>
                          </security>
                          <validation>
                              <check-valid-connection-sql>select 0</check-valid-connection-sql>
                          </validation>
                          <timeout>
                              <blocking-timeout-millis>120000</blocking-timeout-millis>
                              <idle-timeout-minutes>5</idle-timeout-minutes>
                          </timeout>
                      </datasource>
      

      3. Add in test-vdb.xml java:/test_pg configured in previous step as datasource:

      <model name="test_pg">
              <property name="importer.useFullSchemaName" value="false"/>
      	<property name="importer.tableTypes" value="TABLE,VIEW"/>
      	<property name="importer.importKeys" value="false"/>
              <source name="test_pg" translator-name="myPg" connection-jndi-name="java:/test_pg"/>
          </model>
      

      4. Configure in the test-vdb.xml the following virtual view:

      <model visible = "true" type = "VIRTUAL" name = "views">
              <metadata type = "DDL"><![CDATA[
                create view v as select rank() over (order by a) from test_pg.test_rank
              ]]>
              </metadata>
          </model>
      

      5. Run the following query:

      select * into test_pg.test_rank_copy from views.v ;;
      

      The error is caused by changes from TEIID-5153 issue, that is again the aggressive RuleCollapseSource.removeUnnecessaryInlineView method is guilty which removes all elements from requiredElements collection and calls RuleRaiseAccess.performRaise method which removes child node using NodeEditor.removeChildNode method. As a result in insert command we have not rewritten virtual view (view.v) which can't be resolved by PostgreSQL.

      Show
      1. Create test_rank and test_rank_copy tables in PostgreSQL using the following script: create table test_rank(a integer ); create table test_rank_copy(expr1 integer ); 2. Add postgresql database configuration in standalone-teiid.xml: < datasource jndi-name = "java:/test_pg" pool-name = "test_pg" enabled = "true" use-java-context = "true" > < connection -url>jdbc:postgresql://localhost:5432/test?charSet=utf8</ connection -url> < driver -class>org.postgresql.Driver</ driver -class> < driver >org.postgresql</ driver > < pool > < min -pool-size>2</ min -pool-size> < max -pool-size>70</ max -pool-size> < prefill >false</ prefill > < use -strict-min>false</ use -strict-min> < flush -strategy>FailingConnectionOnly</ flush -strategy> </ pool > < security > < user -name>postgres</ user -name> < password >xxxxxx</ password > </ security > < validation > < check -valid-connection-sql>select 0</ check -valid-connection-sql> </ validation > < timeout > < blocking -timeout-millis>120000</ blocking -timeout-millis> < idle -timeout-minutes>5</ idle -timeout-minutes> </ timeout > </ datasource > 3. Add in test-vdb.xml java:/test_pg configured in previous step as datasource: < model name = "test_pg" > < property name = "importer.useFullSchemaName" value = "false" /> < property name = "importer.tableTypes" value = "TABLE,VIEW" /> < property name = "importer.importKeys" value = "false" /> < source name = "test_pg" translator-name = "myPg" connection-jndi-name = "java:/test_pg" /> </ model > 4. Configure in the test-vdb.xml the following virtual view: < model visible = "true" type = "VIRTUAL" name = "views" > < metadata type = "DDL" > <![CDATA[ create view v as select rank() over (order by a) from test_pg.test_rank ]]> </ metadata > </ model > 5. Run the following query: select * into test_pg.test_rank_copy from views.v ;; The error is caused by changes from TEIID-5153 issue, that is again the aggressive RuleCollapseSource.removeUnnecessaryInlineView method is guilty which removes all elements from requiredElements collection and calls RuleRaiseAccess.performRaise method which removes child node using NodeEditor.removeChildNode method. As a result in insert command we have not rewritten virtual view (view.v) which can't be resolved by PostgreSQL.

      Description

      Follow up ticket for https://issues.jboss.org/browse/TEIID-5153 issue.
      When running the following query:

      select * into test_pg.test_rank_copy from views.v ;;
      

      teiid throws out the following error message:

      2018-02-14 17:43:06,838 WARN  [org.teiid.PROCESSOR] (Worker2_QueryProcessorQueue8) snRPeUo3G+nS TEIID30020 Processing exception for request snRPeUo3G+nS.0 'TEIID30504 test_pg: 0 TEII
      D11013:TEIID11004 Error executing statement(s): [SQL: INSERT INTO "public"."test_rank_copy" ("expr1") SELECT g_0.expr1 FROM v AS g_0]'. Originally TeiidProcessingException 'ERROR:
      relation "v" doesn't exist
        Position: 72' QueryExecutorImpl.java:2157.: org.teiid.core.TeiidProcessingException: TEIID30504 test_pg: 0 TEIID11013:TEIID11004 Error executing statement(s): [SQL: INSERT INTO "pub
      lic"."test_rank_copy" ("expr1") SELECT g_0.expr1 FROM v AS g_0]
              at org.teiid.dqp.internal.process.DataTierTupleSource.exceptionOccurred(DataTierTupleSource.java:397)
              at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:157)
              at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:398)
              at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
              at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:141)
              at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:148)
              at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:111)
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:160)
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:142)
              at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:480)
              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:350)
              at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:47)
              at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:276)
              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:280)
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:115)
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:206)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: org.teiid.translator.jdbc.JDBCExecutionException: 0 TEIID11013:TEIID11004 Error executing statement(s): [SQL: INSERT INTO "public"."test_rank_copy" ("expr1") SELECT g_0.e
      xpr1 FROM v AS g_0]
              at org.teiid.translator.jdbc.JDBCUpdateExecution.executeTranslatedCommand(JDBCUpdateExecution.java:345)
              at org.teiid.translator.jdbc.JDBCUpdateExecution.execute(JDBCUpdateExecution.java:82)
              at org.teiid.dqp.internal.datamgr.ConnectorWorkItem$1.execute(ConnectorWorkItem.java:396)
              at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:358)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:216)
              at com.sun.proxy.$Proxy36.execute(Unknown Source)
              at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:302)
              at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)
              at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:104)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:61)
              ... 6 more
      Caused by: org.postgresql.util.PSQLException: ERROR: relation "v" doesn't exist
        Position: 72
              at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
              at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
              at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
              at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shawkins Steven Hawkins
                Reporter:
                dalex005 dalex dalex
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: