You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Gregory Kline (Jira)" <ji...@apache.org> on 2020/02/19 22:00:00 UTC

[jira] [Created] (NIFI-7171) GenerateTableFetch produces SQLException when MS SQL Server table is empty

Gregory Kline created NIFI-7171:
-----------------------------------

             Summary: GenerateTableFetch produces SQLException when MS SQL Server table is empty
                 Key: NIFI-7171
                 URL: https://issues.apache.org/jira/browse/NIFI-7171
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
    Affects Versions: 1.11.2, 1.10.0
            Reporter: Gregory Kline


When GenerateTableFetch executes with the following conditions ...
 # partition size = 0
 # max value columns are unset
 # connecting to MS SQL Server
 # the target table has 0 rows

... the processor throws a SQLException "Unable to execute SQL select query SELECT -1 FROM [mydb].[dbo].[tbl_test_01] due to java.sql.SQLException: No rows returned from metadata query: SELECT -1 FROM [mydb].[dbo].[tbl_test_01]" and rolls back the flow file. 

The issue appears to be introduced in the fix for https://issues.apache.org/jira/browse/NIFI-5855 when -1 was used in place of "COUNT( * )".  For an empty table, the SQL Server driver returns 0 rows for the query "SELECT -1 FROM <table>".  GenerateTableFetch throws a SQLException when the resultset contains 0 rows.

 

Version details:

MS SQL Server: 12.0.6108.1

JDBC Driver: com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8

JDBC Class: com.microsoft.sqlserver.jdbc.SQLServerDriver

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)