Skip to content

bug: JsonArray#getInstant() made by postgres client throws DateTimeParseException #53

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/test/java/io/vertx/ext/asyncsql/PostgreSQLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import io.vertx.ext.sql.ResultSet;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;

import java.time.Instant;

import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -128,4 +131,27 @@ public void testUpdatingNumericField(TestContext context) {
});
}

@Test
public void testInstant(TestContext context) {
Async async = context.async();
client.getConnection(ar -> {
ensureSuccess(context, ar);
conn = ar.result();
conn.execute("DROP TABLE IF EXISTS test_table", ar1 -> {
ensureSuccess(context, ar1);
conn.execute("CREATE TABLE test_table (instant TIMESTAMP)", ar2 -> {
ensureSuccess(context, ar2);
Instant now = Instant.now();
conn.queryWithParams("INSERT INTO test_table (instant) VALUES (?)", new JsonArray().add(now), ar3 -> {
ensureSuccess(context, ar3);
conn.query("SELECT instant FROM test_table", ar4 -> {
ensureSuccess(context, ar4);
context.assertEquals(ar4.result().getResults().get(0).getInstant(0), now);
async.complete();
});
});
});
});
});
}
}