Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ private <T> void testInferDataType42P18(TestContext ctx, Class<T> type, T value,
ctx.assertEquals("HELLO " + suffix2, str);
}));
}));
PgConnection.connect(vertx, options()).onComplete(ctx.asyncAssertSuccess(conn -> {
conn.begin()
.flatMap(tx -> conn.preparedQuery("SELECT CONCAT('HELLO ', $1)").execute(Tuple.of(value))
.eventually(() -> conn.close())
.onComplete(ctx.asyncAssertFailure(failure -> {
ctx.assertTrue(hasSqlstateCode(failure, "42P18"));
})));
}));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private PrepareStatementCommand prepareCommand(ExtendedQueryCommand<?> queryCmd,
}
} else {
Throwable cause = ar.cause();
if (isIndeterminatePreparedStatementError(cause) && !sendParameterTypes) {
if (queryCmd.autoCommit() && isIndeterminatePreparedStatementError(cause) && !sendParameterTypes) {
ChannelHandlerContext ctx = socket.channelHandlerContext();
// We cannot cache this prepared statement because it might be executed with another type
ctx.write(prepareCommand(queryCmd, false, true), ctx.voidPromise());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Future<PreparedStatement> prepare(String sql, PrepareOptions options) {
.compose(
cr -> Future.succeededFuture(PreparedStatementImpl.create(conn, context, cr, autoCommit())),
err -> {
if (conn.isIndeterminatePreparedStatementError(err)) {
if (autoCommit() && conn.isIndeterminatePreparedStatementError(err)) {
return Future.succeededFuture(PreparedStatementImpl.create(conn, context, options, sql, autoCommit()));
} else {
return Future.failedFuture(err);
Expand Down