one of the documented procedures in this installation of the ACS
ad_get_partner_query   { var_list "partner_id" }   { partner "" }
What it does:
Returns the selection from the gs_partner table for the current partner and url. Selection includes all vars in var_list (default is just partner_id)
Defined in: /web/philip/tcl/ad-partner-defs.tcl

Source code:

    if { [empty_string_p $partner] } {
	set partner [ad_partner_from_cookie]
    set url [ns_conn url]
    # The partner site would be the phrase between the first and second slash
    # Note that the first slash has been removed
    set stub "/[lindex [split $url "/"] 1]"
    set stub [string trim $stub]
    set sql_vars ""
    foreach var $var_list {
	if { ![empty_string_p $sql_vars] } { 
	    append sql_vars ", "
	append sql_vars "partner.$var"
    return "select $sql_vars
            from ad_partner partner, ad_partner_url url
            where partner.partner_id=url.partner_id
            and url.url_stub='[DoubleApos $stub]' 
            and partner.partner_cookie='[DoubleApos [string trim $partner]]'"