>
> > So I am tempted to just
> > hold my nose and hard-code the SQL as JDBC is presumably already
> doing.
JDBC is sending "show transaction_read_only" to find whether it is master
or not.
Victor's patch also started with it, but later it was transformed into
pg_is_in_recovery
by him as it appeared more appropriate to identify the master / slave.
ConnectionFactoryImpl.java:685
+ private boolean isMaster(QueryExecutor queryExecutor, Logger logger)
+ throws SQLException, IOException {
+ byte[][] results = SetupQueryRunner.run(queryExecutor, "show
transaction_read_only", true);
+ String value = queryExecutor.getEncoding().decode(results[0]);
+ return value.equalsIgnoreCase("off");
}
--
Thanks and Regards
Mithun C Y
EnterpriseDB: http://www.enterprisedb.com