On 3/22/17 14:09, Robert Haas wrote: >> The opposite means primary. I can flip the GUC name to "is_primary", if >> that's clearer. > Hmm, I don't find that clearer. "hot standby" has a very specific > meaning; "primary" isn't vague, but I would say it's less specific.
The problem I have is that there is already a GUC named "hot_standby", which determines whether an instance is in hot (as opposed to warm?) mode if it is a standby. This is proposing to add a setting named "in_hot_standby" which says nothing about the hotness, but something about the standbyness. Note that these are all in the same namespace.
I think we could use "in_recovery", which would be consistent with existing naming.
One thing we might want to consider around this -- in 10 we have target_session_attrs=read-write (since 721f7bd3cbccaf8c07cad2707826b83f84694832), which will issue a SHOW transaction_read_only on the connection.
We should probably consider if there is some way we can implement these two things the same way. If we're inventing a new variable that gets pushed on each connection, perhaps we can use that one and avoid the SHOW command? Is the read-write thing really interesting in the aspect of the general case, or is it more about detectinv readonly standbys as well? Or to flip that, would sending the transaction_read_only parameter be enough for the usecase in this thread, without having to invent a new variable?
(I haven't thought it through all the way, but figured I should mention the thought as I'm working through my email backlog.)