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

Syntax Error with Statement.RETURN_GENERATED_KEYS #594

Open
dwenking opened this issue Nov 16, 2023 · 0 comments
Open

Syntax Error with Statement.RETURN_GENERATED_KEYS #594

dwenking opened this issue Nov 16, 2023 · 0 comments

Comments

@dwenking
Copy link

In the provided test case, a CREATE TABLE SQL statement is executed using stmt.executeUpdate(createTableSql, Statement.RETURN_GENERATED_KEYS). This execution unexpectedly results in a syntax error: "syntax error at or near 'RETURNING'".
This behavior is inconsistent with Postgres JDBC.

@Test
public void test() {
    try (Connection con = DriverManager.getConnection("jdbc:pgsql://localhost:5432/test0", "user", "password")) {
        Statement stmt = con.createStatement();
        String createTableSql = "CREATE TABLE table0_0(id INT PRIMARY KEY, value VARCHAR(5));";
        stmt.executeUpdate(createTableSql, Statement.RETURN_GENERATED_KEYS);
    } catch (SQLException e) {
        e.printStackTrace(); // syntax error at or near "RETURNING"
    }
}
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

1 participant