You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prepared statement SELECT tablename FROM SVV_EXTERNAL_TABLES with setFetchSize gives ERROR: portal "c_6-16720547611010" does not exist if number of rows exceeds fetch size
#80
Open
RealTYPICAL opened this issue
Jan 31, 2023
· 1 comment
Error message/stack trace: Exception in thread "main" java.lang.RuntimeException: Failed to read row: ERROR: portal "c_6-16720547611010" does not exist
Any other details that can be helpful: enableFetchRingBuffer=false
fetchSize needs to be less than than the number of rows in the svv_external_tables
Statement still works fine.
Same thing happens when querying SELECT tablename FROM pg_tables
Reproduction code
`
String query = "SELECT tablename FROM SVV_EXTERNAL_TABLES"; // where svv_external_tables has more than 500 rows
PreparedStatement statement = c.prepareStatement(query);
statement.setFetchSize(500);
Driver version
2.1.0.10
Redshift version
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.44903
Client Operating System
UBI8
JAVA/JVM version
openjdk version "17.0.5" 2022-10-18
Problem description
Expected behaviour:
You should be able to use PreparedStatements with a fetchSize less than the number of rows in the svv_external_tables.
Actual behaviour:
If the svv_external_tables number of rows exceeds the fetch size then the portal does not exist issue happens like in: Prepared statement SELECT * FROM pg_catalog.<any_non_empty_table> with setFetchSize gives ERROR: portal "c_2-4858445154544" does not exist #9
Error message/stack trace:
Exception in thread "main" java.lang.RuntimeException: Failed to read row: ERROR: portal "c_6-16720547611010" does not exist
Any other details that can be helpful:
enableFetchRingBuffer=false
fetchSize needs to be less than than the number of rows in the svv_external_tables
Statement still works fine.
Same thing happens when querying SELECT tablename FROM pg_tables
Reproduction code
`
String query = "SELECT tablename FROM SVV_EXTERNAL_TABLES"; // where svv_external_tables has more than 500 rows
PreparedStatement statement = c.prepareStatement(query);
statement.setFetchSize(500);
try (ResultSet resultSet = statement.executeQuery()) {
while (resultSet.next()) {
System.out.println(resultSet.getString(1));
}
}
`
The text was updated successfully, but these errors were encountered: