@@ -38,6 +40,11 @@ public void setUp() throws Exception {
TestUtil.dropSequence(conn, "serialtest_a_seq");
TestUtil.dropSequence(conn, "serialtest_b_seq");
if (TestUtil.haveMinimumServerVersion(conn, ServerVersion.v10)) {
TestUtil.createTable(conn, "identitytest", "id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY");
}
TestUtil.createTable(conn, "serialtest", "a serial, b bigserial, c int");
TestUtil.createTable(conn, "alltypes",
"bool boolean, i2 int2, i4 int4, i8 int8, num numeric(10,2), re real, fl float, ch char(3), vc varchar(3), tx text, d date, t time without time zone, tz time with time zone, ts timestamp without time zone, tsz timestamp with time zone, bt bytea");
@@ -52,6 +59,9 @@ public void tearDown() throws SQLException {
TestUtil.dropTable(conn, "rsmd1");
TestUtil.dropTable(conn, "timetest");
TestUtil.dropTable(conn, "serialtest");
if (TestUtil.haveMinimumServerVersion(conn, ServerVersion.v10)) {
TestUtil.dropTable(conn, "identitytest");
}
TestUtil.dropTable(conn, "alltypes");
TestUtil.dropTable(conn, "sizetest");
TestUtil.dropSequence(conn, "serialtest_a_seq");
@@ -248,6 +258,16 @@ public void testClosedResultSet() throws Exception {
assertEquals("rsmd1", rsmd.getColumnTypeName(1));
}
@Test
publicvoidtestIdentityColumn() throwsException {
assumeMinimumServerVersion(ServerVersion.v10);
assumePreparedStatementMetadataSupported();
PreparedStatement pstmt = conn.prepareStatement("SELECT id FROM identitytest");