Forum OpenACS Development: Error from duplicate acs-subsite package_key

Hi everybody,

We have a strange problem in one of our projects.

We use OACS 5.4.3 / dotrln 2.2.0b1 and postgresql 8.2

Everything was ok till we add new subsite in the site-map.

Since then, we've an error when we create a new dotlrn classe/club :


Database operation "0or1row" failed
(exception NSINT, "Query returned more than one row.")
(Status of PQexec call: none; PQexec returned null pointer)
SQL:
select package_id
from apm_packages
where package_key = 'acs-subsite'
.....

This query return


package_id
------------
239389
240517
240870
461
(4 rows)

My problem is that I don't know if it's normal to have many package_key with the same "key" when we create new subsite

Does anybody have the same problem ?

Thanks for help

Denis

Collapse
Posted by Dave Bauer on
Whatever code is calling that query is incorrect. It is quite normal to have multiple instances of a package key.

You need to track down further what code is generating and calling that query.

Collapse
Posted by Denis Barut on
Hello Dave,

Thanks for the reply !

here the sequence :

Call from the page dotlrn/admin/club-new.tcl

and

dotlrn_community::new (in packages/dotlrn/tcl/community-procs.tcl)
...
set community_id [package_instantiate_object -extra_vars $extra_vars $object_type]
(with no package_name set !)



if {[empty_string_p $community_key]} {
set community_key [dotlrn_community::generate_key -name $pretty_name]
}

check_community_key_valid_p -complain_if_invalid -community_key $community_key -parent_community_id $parent_community_id

set package_id [dotlrn::get_package_id]
set dotlrn_package_id $package_id

# Set up extra vars
if {[empty_string_p $extra_vars]} {
set extra_vars [ns_set create]
}

ns_set put $extra_vars parent_community_id $parent_community_id
ns_set put $extra_vars community_type $community_type
ns_set put $extra_vars community_key $community_key
ns_set put $extra_vars pretty_name $pretty_name
ns_set put $extra_vars pretty_plural $pretty_name
ns_set put $extra_vars description $description
ns_set put $extra_vars context_id $dotlrn_package_id

db_transaction {
set user_id [ad_conn user_id]
set community_id [package_instantiate_object -extra_vars $extra_vars $object_type]
....

package_instantiate_object (in packages/acs-subsite/tcl/package-procs.tcl)
and since there is no package_name then he do the query ....
...

if {$variable_prefix ne ""} {
append variable_prefix "."
}

# Select out the package name if it wasn't passed in
if { $package_name eq "" } {
if { ![db_0or1row package_select {
select t.package_name
from acs_object_types t
where t.object_type = :object_type
}] } {
error "Object type \"$object_type\" does not exist"
}
}
....

I've check with the head code and it's the same.

Denis