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

Duplicate Rows with XMLTABLE

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 15.0.1
    • Query Engine
    • None
    • Hide

      1. In PostgreSQL create the "epettest1" empty table using the following scripts:

      CREATE TABLE public.epettest1
      (
        a integer
      );
      

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

                      <datasource jndi-name="java:/test_dwh_pg" pool-name="test_dwh_pg" enabled="true" use-java-context="true">
                          <connection-url>jdbc:postgresql://localhost:5432/test_dwh?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>xxxxx</user-name>
                              <password>xxxxx</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_dwh_pg configured in the previous step as a data source:

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

      4. Run the following query:

      SELECT * 
      	FROM (
      		SELECT cast('<foo><timestamp>1</timestamp></foo>' AS xml) AS x  
      		UNION ALL
      		--Second query in UNION ALL returns no rows as "test_dwh_pg.epettest1" table is empty
      		SELECT cast('<tag></tag>' AS xml) AS x FROM test_dwh_pg.epettest1
      	) AS raw, 
      	xmltable( 
      	 '/foo' PASSING raw.x 
      	 COLUMNS 
      	 	"timestamp" integer
      	) AS y ;;
      
      Show
      1. In PostgreSQL create the "epettest1" empty table using the following scripts: CREATE TABLE public .epettest1 ( a integer ); 2. Add PostgreSQL database configuration in standalone-teiid.xml: <datasource jndi-name= "java:/test_dwh_pg" pool-name= "test_dwh_pg" enabled= "true" use-java-context= "true" > <connection-url> jdbc:postgresql://localhost:5432/test_dwh?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> xxxxx </user-name> <password> xxxxx </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_dwh_pg configured in the previous step as a data source: <model name= "test_dwh_pg" > <property name= "importer.useFullSchemaName" value= "false" /> <property name= "importer.tableTypes" value= "TABLE,VIEW" /> <property name= "importer.importKeys" value= "false" /> <source name= "test_dwh_pg" translator-name= "myPg" connection-jndi-name= "java:/test_dwh_pg" /> </model> <translator name= "myPg" type= "postgresql" > <property name= "SupportsNativeQueries" value= "true" /> </translator> 4. Run the following query: SELECT * FROM ( SELECT cast ( '<foo>< timestamp >1</ timestamp ></foo>' AS xml) AS x UNION ALL -- Second query in UNION ALL returns no rows as "test_dwh_pg.epettest1" table is empty SELECT cast ( '<tag></tag>' AS xml) AS x FROM test_dwh_pg.epettest1 ) AS raw , xmltable( '/foo' PASSING raw .x COLUMNS " timestamp " integer ) AS y ;;
    • Undefined

    Description

      When running the following query:

      SELECT * 
      	FROM (
      		SELECT cast('<foo><timestamp>1</timestamp></foo>' AS xml) AS x  
      		UNION ALL
      		--Second query in UNION ALL returns no rows as "test_dwh_pg.epettest1" table is empty
      		SELECT cast('<tag></tag>' AS xml) AS x FROM test_dwh_pg.epettest1
      	) AS raw, 
      	xmltable( 
      	 '/foo' PASSING raw.x 
      	 COLUMNS 
      	 	"timestamp" integer
      	) AS y ;;
      

      Teiid returns two rows from time to time instead of only one row.

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            dalex005 Dmitrii Pogorelov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: