In index.tcl (and also update-supervisor.tcl):
The rewrite of the outer join on
- users_active
- im_employee_info
- user_group_map
- users (omitted in the rewrite)
as a UNION does not work. I tried the two parts of the UNION
separately, and they worked independently. However, with the UNION in
place, when I run the query from psql (substituting where needed for
any of the Tcl used within the SQL), I got some sort of weird
Postgresql error message. It looks like it's having trouble with the
ORDER BY at the end of the UNION. Looks to me like a bug in
Postgresql...
My initial idea for a workaround was to create a temp table and then
order from the temp table (after doing two INSERT statements into the
temp table, in place of the UNION). However, as I soon discovered,
the
ns_db dml $db
statement does not permit the creation of tables, whether temporary or
permanent, which probably means that a more convoluted workaround will
be necessary.
In update-supervisor-2.tcl:
The two validate_integer statements were broken (missing the curly
braces). The fixed lines are as follows:
validate_integer user_id ${dp.im_employee_info.user_id}
validate_integer supervisor_id ${dp.im_employee_info.supervisor_id}