Forum .LRN Q&A: "Weekly" calendar problem

Collapse
Posted by Jon Rowell on
I am running dotlrn 2.0.

I have a user who is unable to access their "Weekly" view of their calendar.  The following error is generated.  I tried pasting the query directly into postgres but I get the same error which tells me it is a problem with postgres itself and not the code.

All other views of the calendar work fine.  It is just the weekly view.  It is only happening to one user.  All other users do not have a problem with the calendar.

Jon Rowell

NOTICE:  Adding missing FROM-clause entry in subquery for table "cal_items"
[21/Sep/2004:13:46:37][28790.1079761728][-conn1-] Error: Ns_PgExec: result status: 7 message: ERROR:  More than one tuple retu
rned by a subselect used as an expression.

[21/Sep/2004:13:46:37][28790.1079761728][-conn1-] Error: GET http://[edited]/dotlrn/calendar/view?view=week&d
ate=2004-09-21
referred by "http://[edited]"
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")

ERROR:  More than one tuple returned by a subselect used as an expression.

SQL:
select  to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date,
        to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date,
        coalesce(e.name, a.name) as name,
        coalesce(e.status_summary, a.status_summary) as status_summary,
        e.event_id as item_id,
        (to_date(start_date,'YYYY-MM-DD HH24:MI:SS')  - to_date('2004-09-19 00:00:00',
        'YYYY-MM-DD HH24:MI:SS')) as day_of_week,
        (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type,
        cals.calendar_id,
        cals.calendar_name
from    acs_activities a,
        acs_events e,
        timespans s,
        time_intervals t,
        cal_items ci,
        calendars cals
where    e.timespan_id = s.timespan_id
and      s.interval_id = t.interval_id
and      e.activity_id = a.activity_id
and      start_date between
        to_date('2004-09-19 00:00:00', 'YYYY-MM-DD HH24:MI:SS') and
        to_date('2004-09-25 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
and      cals.calendar_id = ci.on_which_calendar
and      e.event_id = ci.cal_item_id
and ((cals.package_id= '1449' and cals.private_p='f') or (cals.private_p='t' and cals.owner_id= '7821'))
order by to_char(start_date, 'J'), to_char(start_date,'HH24:MI')

    while executing
"ns_pg_bind select nsdb0 {
select  to_char(start_date, :ansi_date_format) as ansi_start_date,
        to_char(end_date, :ansi_date_format) as ansi_en..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
    ("postgresql" arm line 2)
    invoked from within
"switch $driverkey {
                oracle {
                    return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
                }
      ..."
    invoked from within
"db_exec select $db $full_statement_name $sql"
    invoked from within
"set selection [db_exec select $db $full_statement_name $sql]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle -dbn $dbn db {
        set selection [db_exec select $db $full_statement_name $sql]

        set counter 0
        while { [db_getrow $..."
    (procedure "db_foreach" line 36)