in 5.2-pg bind variable substitution is currently broken because of a wrong number of uplevels in ds_collect_db_call. in line "uplevel 4 [list db_bind_var_substitution $sql]" uplevel should be 3. the problem arised because in older versions "ds_collect_db_call" was called via ad_call_proc_if_exists and now it is called directly. therefor the number of stack levels is different. maybe someone with commit rights can correct that error.