Permalink
Browse files

test: assume minimum server version 8.3 when testing with uuid

The UUID datatype was added to PostgreSQL in version 8.3.

https://www.postgresql.org/docs/8.3/static/release-8-3.html
  • Loading branch information...
grzm authored and vlsi committed Jul 22, 2017
1 parent 77ee528 commit ff2717e42a8c0394e6cde4527ed1f721ffa9fb84
Showing with 9 additions and 2 deletions.
  1. +9 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ResultSetTest.java
@@ -10,7 +10,9 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import org.postgresql.core.ServerVersion;
import org.postgresql.jdbc.PreferQueryMode;
import org.postgresql.test.TestUtil;
import org.postgresql.util.PGobject;
@@ -303,10 +305,15 @@ public void testgetBadBoolean() throws SQLException {
testBadBoolean("'2017-03-13'::date", "2017-03-13");
testBadBoolean("'2017-03-13 14:25:48.130861'::time", "14:25:48.130861");
testBadBoolean("ARRAY[[1,0],[0,1]]", "{{1,0},{0,1}}");
testBadBoolean("'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid", "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
testBadBoolean("29::bit(4)", "1101");
}
@Test
public void testGetBadUuidBoolean() throws SQLException {
assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3));
testBadBoolean("'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid", "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
}
public void testBadBoolean(String select, String value) throws SQLException {
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select " + select);
@@ -877,7 +884,7 @@ public void testPreparedStatementResultSetColumnMappingCache() throws SQLExcepti
*/
@Test
public void testNamedPreparedStatementResultSetColumnMappingCache() throws SQLException {
Assume.assumeTrue("Simple protocol only mode does not support server-prepared statements",
assumeTrue("Simple protocol only mode does not support server-prepared statements",
preferQueryMode != PreferQueryMode.SIMPLE);
PreparedStatement pstmt = con.prepareStatement("SELECT id FROM testrs");
ResultSet rs;

0 comments on commit ff2717e

Please sign in to comment.