Skip to content

Syntax Error with Statement.RETURN_GENERATED_KEYS #594

@dwenking

Description

@dwenking

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"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions