Forum OpenACS Development: Response to Problems with loading the calendar module

Collapse
Posted by Charles Mok on
I have replaced the "unique" with "distinct" in the postresql.xql (cal-options-postgresql.xql)file. But I still got this error
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")
        while executing
    "ns_pg_bind select nsdb0 {
          

        select   distinct(calendar_id) as calendar_id,
                 calendar_name,
                 ' ' as checked_p
        fro..."
        ("uplevel" body line 1)
        invoked from within
    "uplevel $ulevel [list ns_pg_bind $type $db $sql"
        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 db {
            set selection [db_exec select $db $full_statement_name $sql]

            set counter 0
            while { [db_getrow $db $selection] } {
                if { [e..."
        (procedure "db_multirow" line 28)
        invoked from within
    "db_multirow calendars get_readable_calendars {

        select   unique(calendar_id) as calendar_id,
                 calendar_name,
                 ' ' as check..." --this query is from the tcl file. Am I suppose to change unique to distinct?
        ("uplevel" body line 78)
        invoked from within
    "uplevel {
              # /packages/calendar/www/cal-nav.tcl

......
This is the actual query in the xql file
    select   distinct(calendar_id) as calendar_id,
             calendar_name,
             ' ' as checked_p
    from     calendars
    where    acs_permission__permission_p(calendar_id, :user_id, 'calendar_read$    and      acs_permission__permission_p(calendar_id, :user_id, 'calendar_show$    and      private_p = 'f'

    union

    select  distinct(on_which_calendar) as calendar_id,
            calendar__name(on_which_calendar) as calendar_name,
            ' ' as checked_p
    from    cal_items
    where   acs_permission__permission_p(cal_item_id, :user_id, 'cal_item_read'$    and     calendar__private_p(on_which_calendar) = 'f'