Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@RealTYPICAL
Copy link

RealTYPICAL commented Jan 31, 2023

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

  1. Expected behaviour:
    You should be able to use PreparedStatements with a fetchSize less than the number of rows in the svv_external_tables.

  2. 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

  3. Error message/stack trace:
    Exception in thread "main" java.lang.RuntimeException: Failed to read row: ERROR: portal "c_6-16720547611010" does not exist

  4. 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));
}
}
`

@bhvkshah
Copy link
Contributor

Thanks for submitting this issue, we will look into it and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants