Forum .LRN Q&A: error adding classes when everything else worked fine :(

BUT :) .. when I drill down I am getting a 0or1row returned more than one row when I try to add classes or clubs (already set up depts and subject succesfully). Any general thoughts would be appreciated..

Database operation "0or1row" failed (exception NSINT, "Query returned more than one row.")
    while executing
"ns_pg_bind 0or1row nsdb0 {
            select datasource_id
            from portal_datasources
            where name = :ds_name
        }"
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
    invoked from within
"db_exec 0or1row $db $full_statement_name $sql"
    invoked from within
"set selection [db_exec 0or1row $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 0or1row $db $full_statement_name $sql]
    }"
    (procedure "db_0or1row" line 22)
    invoked from within
"db_0or1row select {}"
    (procedure "get_datasource_id" line 2)
    invoked from within
"get_datasource_id $ds_name"
    (procedure "get_element_ids_by_ds" line 2)
    invoked from within
"get_element_ids_by_ds $portal_id $portlet_name"
    (procedure "portal::add_element_parameters" line 9)
    invoked from within
"portal::add_element_parameters  -pretty_name [get_pretty_name]  -portal_id $portal_id  -page_name $page_name  -portlet_name [get_my_name]  -key "commu..."
    (procedure "dotlrn_members_portlet::add_self_to_page" line 3)
    invoked from within
"dotlrn_members_portlet::add_self_to_page  -portal_id $portal_id  -community_id $community_id  -page_name [members_community_default_page]"
    ("default" arm line 2)
    invoked from within
"switch $type {
            dotlrn_class_instance {
                dotlrn_members_staff_portlet::add_self_to_page  -portal_id $portal_id  -community_i..."
    (procedure "dotlrn_dotlrn::add_applet_to_community" line 14)
    invoked from within
"dotlrn_dotlrn::add_applet_to_community $community_id"
    (procedure "AcsSc.dotlrn_applet.AddAppletToCommunity.dotlrn_dotlrn" line 1)
    invoked from within
"AcsSc.dotlrn_applet.AddAppletToCommunity.dotlrn_dotlrn 2420"
    ("uplevel" body line 1)
    invoked from within
"uplevel $func_and_args"
    (procedure "apply" line 3)
    invoked from within
"apply $proc_name $arguments"
    (procedure "acs_sc_call" line 5)
    invoked from within
"acs_sc_call dotlrn_applet $op $list_args $applet_key"
    (procedure "applet_call" line 2)
    invoked from within
"applet_call  $applet_key  AddAppletToCommunity  [list $community_id]"
    invoked from within
"set package_id [applet_call  $applet_key  AddAppletToCommunity  [list $community_id]]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 1)
    invoked from within
"db_transaction {
            set package_id [applet_call  $applet_key  AddAppletToCommunity  [list $community_id]]

            register_a..."
    (procedure "dotlrn_community::add_applet_to_community" line 2)
    invoked from within
"dotlrn_community::add_applet_to_community $community_id $applet_key"
    ("foreach" body line 3)
    invoked from within
"foreach applet_key $default_applets_list {
                if {[dotlrn_applet::applet_exists_p -applet_key $applet_key]} {
                    dotlrn_..."
    ("uplevel" body line 66)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 39)
    invoked from within
"db_transaction {
            set user_id [ad_conn user_id]
            set community_id [package_instantiate_object -extra_vars $extra_vars $object_ty..."
    (procedure "dotlrn_community::new" line 25)
    invoked from within
"dotlrn_community::new  -community_type [community_type]  -object_type [community_type]  -pretty_name $pretty_name  -description $description  -parent_..."
    (procedure "dotlrn_club::new" line 6)
    invoked from within
"dotlrn_club::new  -description $description  -pretty_name $pretty_name  -join_policy $join_policy"
    invoked from within
"if {[form is_valid add_club]} {
    form get_values add_club  pretty_name description join_policy referer

    set key [dotlrn_club::new  -description..."
    ("uplevel" body line 41)
    invoked from within
"uplevel {
          #
#  Copyright (C) 2001, 2002 MIT
#
#  This file is part of dotLRN.
#
#  dotLRN is free software; you can redistribute it and/or modi..."
    (procedure "code::tcl::/web/site/packages/dotlrn/www/admin/club-new" 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..."

select name from portal_datasources group by name having count(name) > 1;
            name
------------------------------
dotlrn_admin_portlet
dotlrn_members_portlet
dotlrn_members_staff_portlet
dotlrn_portlet

Did I somehow install a package twice?

Sure looks like it ... the datamodel should guard against that but I guess it doesn't.  File a bug report please, and let us know if you can figure out how you managed to install it twice.
Just tried

delete from portal_datasources where datasource_id in (select  min(datasource_id) from portal_datasources group by name having count(name) > 1);

(in other words I assumed the earlier entry was useless)

That fixed the problem but doesn't explain how it got in there twice! I'm not sure - I dropped the datamodel each time before re-installing as I played with it over the weekend.

Don, if you think I should file a bug report, I'll do so - I just don't want to file something vague that can't ever be closed. I guess maybe just double checking the unique constraint on that table should clear things up - would at least cause it to blow up sooner rather than later!

FWIW - I was using OACS4.6 downloaded as of Mar 15 2003 give or take a day.

I'm having the same problem (can't add classes or communities) but I haven't installed twice any modules.

When I run the query:

select name from portal_datasources group by name having count(name) > 1;

It returns 0 rows.

I've downloaded the sources a few days before Alfred.

Any ideas would be appreciated.

Post the error message you get ..
We tightened up the naming convention for datamodel creation files so they now *must* be "package-key-create.sql".

Now ... this second problem, new-portal not being loaded at all, was due to that change as its create file was named "portal-create.sql".  It's been renamed and committed but there was a small window of time where the CVS sources didn't have that change.

So grabbing the latest sources on the dotlr-1-0 branch should fix that.

We didn't make this change for whimsical reasons, forums has create files named "forums-create.sql" and "forums-forums-create.sql" and the second was loaded twice (because it's called from "forums-create.sql")  It hadn't been noticed before because the .info file hadn't listed it.

Anyway ... fixing the one problem unmasked the other but the current sources on the dotlrn-1-0 branch do load for the rest of us.