Query the current "branch name" and "compute endpoint hostname" from server side SQL

Is there a PostgreSQL ( server side ) function or metadata to query:

  • the current “branch_id” ( or branch name ) ?
  • the current “compute endpoint hostname” ?

I have found some neon related id-s, but not this info:

select name,setting,short_desc 
from pg_settings 
where name like 'neon%_id';

-[ RECORD 1 ]-----------------------------------------
name       | neon.tenant_id
setting    | e94777f458ed138d1efabc637287345e
short_desc | Neon tenant_id the server is running on
-[ RECORD 2 ]-----------------------------------------
name       | neon.timeline_id
setting    | f7517fea2259ce2defc5dacb8221528c
short_desc | Neon timeline_id the server is running on

It’s not very important, but it can help if I want to stop the test code from deleting tables in the production database.
( ~ using this information in server side business logic in PL/pgSQL )

1 Like