Thank you all.
I did look for a magic object before I asked the question and saw several useful pieces of information stored there, but this was not one of them.
I guess by "the permissions view" you mean acs_permissions_all? Is there any reason that I shouldn't also join with the acs_magic_objects table? Something like:
set admin_user_id [db_string select_admin_user_id {
select min(user_id)
from users u, acs_permissions_all p, acs_magic_objects a
where u.user_id = p.grantee_id
and p.object_id = a.object_id
and a.name = 'default_context'
}]