Can I use my own validation query on postgreSQL?

I use Aurora postgreSQL cluster on AWS.
I attempted failover test on aurora postgreSQL, but a few connections still alive on read cluster.
I want to reconnect all connections to new writer cluster immediately!!
I want to use select result from (SELECT pg_is_in_recovery() as result) as t where result='f'; for validation query.

Can I use my own validation query on postgreSQL?

Please help me…!!!

Where in Kong do you want to use this query?

You could disconnect the connections from the read cluster server and then update the DNS to the new write cluster, when Kong tries to connect to PG, it will go to your new cluster.
Please ensure you have low DNS TTLs.