Skip to content

Commit 48d21d3

Browse files
committed
The issue was NOT with the getSnapshotHistory function itself, but with PostgreSQL queries being executed somewhere in your application that were causing prepared statement parameter binding issues.
1 parent 1b7d4b9 commit 48d21d3

File tree

1 file changed

+14
-0
lines changed
  • server/api-service/lowcoder-plugins/postgresPlugin/src/main/java/org/lowcoder/plugin/postgres

1 file changed

+14
-0
lines changed

server/api-service/lowcoder-plugins/postgresPlugin/src/main/java/org/lowcoder/plugin/postgres/PostgresConnector.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,19 @@ protected void setUpConfigs(PostgresDatasourceConfig datasourceConfig, HikariCon
5454
} else {
5555
config.setReadOnly(false);
5656
}
57+
58+
// Fix for PostgreSQL prepared statement parameter binding issues
59+
// Disable prepared statement caching to prevent S_1, S_2, S_11 errors
60+
config.addDataSourceProperty("preparedStatementCacheQueries", "0");
61+
config.addDataSourceProperty("preparedStatementCacheSizeMiB", "0");
62+
63+
// Add connection validation to reset prepared statement state
64+
config.addDataSourceProperty("testOnBorrow", "true");
65+
config.addDataSourceProperty("validationQuery", "SELECT 1");
66+
67+
// Additional PostgreSQL-specific optimizations
68+
config.addDataSourceProperty("reWriteBatchedInserts", "true");
69+
config.addDataSourceProperty("cachePrepStmts", "false");
70+
config.addDataSourceProperty("useServerPrepStmts", "false");
5771
}
5872
}

0 commit comments

Comments
 (0)