Forum OpenACS Q&A: Weird Forums/acs-tcl error...
I found this strange bug on my 4.6.3 instance Im working with. I was trying to post a message to a forum I created, which is mounted in 2 different sections within my website, and I got this error:
Request Error
Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
while executing
"ns_pg_bind 0or1row nsdb0 {
select sn1.object_id
from site_nodes sn1,
apm_packages
where sn1.paren..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
invoked from within
"db_exec 0or1row $db $full_name $sql"
invoked from within
"set selection [db_exec 0or1row $db $full_name $sql]"
("uplevel" body line 2)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle db {
set selection [db_exec 0or1row $db $full_name $sql]
}"
(procedure "db_string" line 7)
invoked from within
"db_string select_child_package_id {} -default """
(procedure "get_child_package_id" line 7)
invoked from within
"get_child_package_id -package_id $package_id -package_key $package_key"
(procedure "site_node_apm_integration::child_package_exists_p" line 3)
invoked from within
"site_node_apm_integration::child_package_exists_p -package_key attachments"
(procedure "forum::attachments_enabled_p" line 2)
invoked from within
"forum::attachments_enabled_p"
invoked from within
"set attachments_enabled_p [forum::attachments_enabled_p]"
("uplevel" body line 53)
invoked from within
"uplevel {
ad_page_contract {
Form to create message and insert it
@author Ben Adida (mailto:ben@openforce.net)
@creation-date 2002-0..."
(procedure "code::tcl::/web/naciones/packages/forums/www/message-post" 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 "fixed" the error by unmounting the forums instance from one location, and putting instead a new instance, but I believe this cant be a complete solution to my problem. Does anyone have any ideas? I tried tracing the source of the error, and I came as far as tracing this query:
<fullquery name="site_node_apm_integration::get_child_package_id.select_child_package_id">
<querytext>
select sn1.object_id
from site_nodes sn1,
apm_packages
where sn1.parent_id = (select sn2.node_id
from site_nodes sn2
where sn2.object_id = :package_id)
and sn1.object_id = apm_packages.package_id
and apm_packages.package_key = :package_key
</querytext>
</fullquery>
thats on .../acs-tcl/tcl/site-node-apm-integration-procs.xql
When I tried the full query, it gave out this error:
ERROR: More than one tuple returned by a subselect used as an expression.
I tried the inner select query just to make sure, and indeed, it gave out more than one value, so apparently that was the reason for the query not to work in the first place. Just out of curiosity, I checked the node_id of the original forums instance and the mounted forums instance, and I found that they were the results that came out from the inner select query, and that was how I came to think of my "fix". I desided that instead of trying to fix this bug on my own, it would be best to post it here, just in case anyone else had experienced the same error before.
I will use the "fix" I mentioned before as a partial solution, but I would appreciate it if someone could take a look at this and try to guide me in the right direction.
Thanks in advance.