Forum .LRN Q&A: Bulk user import failure

Collapse
Posted by Yo Mama on
I'm trying to use /dotlrn/admin/users-bulk-upload to upload bulk users. This is oacs-5.0.2 with the latest dotlrn-2-0-0-final tag files from CVS. If I put in a file to the tune of:

first_names,last_name,email,id,type,access_level,guest
Anne,Borchert,mailto:amb14@cwru.edu,amb14,student,full,f

I get out:

[11/Feb/2004:16:45:05][16650.7][-conn:eecs::3] Error: Problem creating a new use
r: Database operation "0or1row" failed (exception NSDB, "Query was not a stateme
nt returning rows.")

ERROR:  null value in column "username" violates not-null constraint
CONTEXT:  PL/pgSQL function "acs_user__new" line 54 at SQL statement
PL/pgSQL function "acs__add_user" line 21 at assignment

SQL:

            select acs__add_user(
                '3672',
                'user',
                now(),
                null,
                '129.22.151.163',
                NULL,
                NULL,
                'mailto:amb14@cwru.edu';,
                NULL,
                'Anne',
                'Borchert',
                '4A46E76A4775330775B3F0073E1A1824CBFA9EDC',
                'FCB471FEE0F747650EB16984567EA02991D5C839',
                NULL,
                't',
                'approved'
            );


    while executing
"ns_pg_bind 0or1row nsdb0 {

            select acs__add_user(
                :user_id,
                'user',
                now(),
              ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
    ("postgresql" arm line 2)
    invoked from within
"switch $driverkey {
                oracle {
                    return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
                }
      ..."
    invoked from within
"db_exec 0or1row $db $full_statement_name $sql"
    invoked from within
"if {[regexp -nocase -- {^\s*select} $test_sql match]} {
                ns_log Debug "PLPGSQL: bypassed anon function"
                set selection [..."
    ("uplevel" body line 6)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle -dbn $dbn db {
            # plsql calls that are simple selects bypass the plpgsql
            # mechanism for creating anonymous fun..."
    (procedure "db_exec_plsql" line 57)
    invoked from within
"db_exec_plsql user_insert {}"
    invoked from within
"set user_id [db_exec_plsql user_insert {}]"
    ("uplevel" body line 3)
    invoked from within
"uplevel 1 $transaction_code "

From what I can tell, packages/dotlrn/www/admin/users-bulk-upload-2.tcl is not inserting a value for username (it only seems to call ad_user_new with email, first/last names, and password data). I'm stumped with what to do, any suggestions?

Collapse
Posted by Matthew Burke on
I came across this problem two days ago---I would've posted a bug report, but I've got around a zillion homework sets to grade...so it slipped off my radar screen.

In users-bulk-upload-2.tcl (found in packages/dotlrn/www/admin) change the line

set user_id [ad_user_new $row(email) $row(first_names) $row(last_name) $password "" "" "" "t" "approved"]

to read

set user_id [ad_user_new $row(email) $row(first_names) $row(last_name) $password "" "" "" "t" "approved" "" $row(id)]

Matt

Collapse
Posted by Yo Mama on
Matt,

Thanks! That did the trick. I thought it would be one of the existing ""'s, no clue that you had to add on to the end to fix this.

Simon