Forum OpenACS Q&A: Error in Forums package

Collapse
Posted by Amit Kr. Singh on
When i try to create a moderated forum i get an error like
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")
       while executing
   "ns_pg_bind select nsdb0 {
               select fm.message_id,
                      fm.subject,
                      fm.user_id,
                      person__n..."
       ("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 local_counter 0

           while { [db_getrow $db $selection] } {..."
       (procedure "db_multirow" line 40)
       invoked from within
   "db_multirow messages $query {} {
       set subject [ad_quotehtml $subject]
       set user_name [ad_quotehtml $user_name]
   }"
       ("uplevel" body line 63)
       invoked from within
   "uplevel {
             ad_page_contract {

       one forum view

       @author Ben Adida (ben@openforce.net)
       @creation-date 2002-05-24
       @cvs-id $Id: foru..."
       (procedure "code::tcl::/web/balaton/packages/forums/www/forum-view" line 2)
       invoked from within
   "code::tcl::$__adp_stub"
       invoked from within
   "if { [file exists $__adp_stub.tcl] } {

         # ensure that data source preparation procedure exists and is up-to-date
         adp_init tcl $__adp_stub
   ..."
       ("uplevel" body line 3)
       invoked from within
   "uplevel {

       if { [file exists $__adp_stub.tcl] } {

         # ensure that data source preparation procedure exists and is up-to-date
         adp_init t..."
       (procedure "adp_prepare" line 2)
       invoked from within
   "adp_prepare "
       (procedure "template::adp_parse" line 30)
       invoked from within
   "template::adp_parse [file root [ad_conn file]] {}"
       (procedure "adp_parse_ad_conn_file" line 7)
       invoked from within
   "$handler"
       ("uplevel" body line 2)
       invoked from within
   "uplevel $code"
       invoked from within
   "ad_try {
           $handler
         } ad_script_abort val {
           # do nothing
         }"
       invoked from within
   "rp_serve_concrete_file [ad_conn file]"
       (procedure "rp_serve_abstract_file" line 60)
       invoked from within
   "rp_serve_abstract_file "$root/$path""
       ("uplevel" body line 2)
       invoked from within
   "uplevel $code"
       invoked from within
   "ad_try {
           rp_serve_abstract_file "$root/$path"
           set tcl_url2file([ad_conn url]) [ad_conn file]
           set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."
I am using the CVS code downloded couple of days ago on pg 7.2.3 RH 7.2. Am i doing something wrong
Collapse
Posted by Amit Kr. Singh on
Open the file "forum-view-postgresql.xql"

in the second query delete the line in bold


            select fm.message_id,
                   fm.subject,
                   fm.user_id,
                   person__name(fm.user_id) as user_name,
                   fm.posting_date,
                   fm.state,
                   (select count(*)
                    from forums_messages fm1
                    where fm1.forum_id = :forum_id
                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
                   to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
case when fm.last_child_post > (now() - 1) then 't' else 'f' end as new_p
              
                   case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p                   
            from forums_messages_approved fm
            where fm.forum_id = :forum_id
            and fm.parent_id is null
            order by fm.posting_date desc