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

Error "Received resultset tuples, but no field structure for them" when fetching from subscription cursor #17716

Closed
neverchanje opened this issue Jul 17, 2024 · 1 comment
Assignees
Labels
no-issue-activity type/bug Something isn't working
Milestone

Comments

@neverchanje
Copy link
Contributor

Describe the bug

No response

Error message/log

No response

To Reproduce

package com.risingwave;

import org.junit.jupiter.api.Test;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class TestSubscription {
    public void createAndTest() throws SQLException {
        TestCreateTable.createSourceTable();
        try (Connection conn = TestUtils.establishConnection()) {
            // Step 1: Create a subscription
            String createSubscription = "CREATE SUBSCRIPTION sub4 FROM s1_java WITH (retention = '1 hour')";
            try (PreparedStatement createStmt = conn.prepareStatement(createSubscription)) {
                createStmt.execute();
                System.out.println("Subscription created successfully.");
            }
            // Step 2: Declare a subscription cursor
            String declareCursor = "DECLARE cur4 SUBSCRIPTION CURSOR FOR sub4";
            try (PreparedStatement declareStmt = conn.prepareStatement(declareCursor)) {
                declareStmt.execute();
                System.out.println("Subscription cursor declared successfully.");
            }
            // Step 3: Fetch data from the subscription cursor
            String fetchData = "FETCH NEXT FROM cur4";
            try (PreparedStatement fetchStmt = conn.prepareStatement(fetchData)) {
                ResultSet rs = fetchStmt.executeQuery();
                while (rs.next()) {
                    Object v1 = rs.getObject("v1");
                    assertNotNull(v1);
                }
            }
        }
    }

    public void dropSubscription() throws SQLException {
        try (Connection conn = TestUtils.establishConnection()) {
            PreparedStatement stmt = conn.prepareStatement("DROP SUBSCRIPTION sub4");
            stmt.execute();
            System.out.println("Subscription dropped successfully.");
        }
    }

    @Test
    public void testSubscription() throws SQLException {
        try {
            createAndTest();
        } finally {
            dropSubscription();
            TestCreateTable.dropSourceTable();
        }
    }
}

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

PostgreSQL 13.14.0-RisingWave-1.11.0-alpha (unknown)

Additional context

No response

@neverchanje neverchanje added the type/bug Something isn't working label Jul 17, 2024
@github-actions github-actions bot added this to the release-1.11 milestone Jul 17, 2024
Copy link
Contributor

This issue has been open for 60 days with no activity.

If you think it is still relevant today, and needs to be done in the near future, you can comment to update the status, or just manually remove the no-issue-activity label.

You can also confidently close this issue as not planned to keep our backlog clean.
Don't worry if you think the issue is still valuable to continue in the future.
It's searchable and can be reopened when it's time. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue-activity type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants