(connection)
| 1215 | be a replica/standby server. |
| 1216 | """ |
| 1217 | async def can_be_used(connection): |
| 1218 | settings = connection.get_settings() |
| 1219 | hot_standby_status = getattr(settings, 'in_hot_standby', None) |
| 1220 | if hot_standby_status is not None: |
| 1221 | is_in_hot_standby = hot_standby_status == 'on' |
| 1222 | else: |
| 1223 | is_in_hot_standby = await connection.fetchval( |
| 1224 | "SELECT pg_catalog.pg_is_in_recovery()" |
| 1225 | ) |
| 1226 | return is_in_hot_standby == should_be_in_hot_standby |
| 1227 | |
| 1228 | return can_be_used |
| 1229 |
nothing calls this directly
no test coverage detected