Find the region to which I am connected

I am testing with 19.1 and have a cockroachdb cluster running in three localities. I would like to be able to discover the region to which my app is connected. I see show locality in 19.2, but can’t use that yet.
Thanks
Allen

Hey Allen!

You can use the table crdb_internal.gossip_nodes to see that information pre 19.2.

Let me know if that works for you.

Thanks,
Matt

Matt,
That lists all the nodes but I still don’t know which one I am connected to, right? To find the node to which my session is connected, I am now using this

select node_id from [show local sessions];
node_id
±--------+
9
9
9
9
9
(5 rows)

I just grab the node id from the first row to know which node I am on. Seems to be reliable, but crude.
Thanks
Allen

Yes, that is one way to do it.

Another way is show session node_id;. And then using the gossip nodes table to see the locality of the node.