[rt-devel] Insertion of NULL errors with SearchBuilder/Oracle

Brook Schofield brooksch at mac.com
Sun Apr 13 14:14:40 EDT 2003


Addition: I don't think there are many DBIx::SearchBuilder/Oracle users 
out there as a simple Create call results in the following error:

[Sun Apr 13 17:41:10 2003] [crit]: RT::Handle=HASH(0xd4a67c) couldn't 
execute the query 'INSERT INTO Users (id, Comments, Password, 
LastUpdatedBy, Created, id, RealName, Creator, Name, LastUpdated) 
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'ORA-00957: duplicate column name 
(DBD ERROR: OCIStmtExecute)
  (/opt/rt3/lib/RT.pm:228)
make: *** [initialize-database] Error 255

this is because there is/was no duplicate checking within Insert(). 
I've got a whole swag of patches so I'll send them all through soon. If 
you look really carefully you'll notice that the Comments field/column 
is actually a CLOB type - and it inserts correctly ;-)

I've managed to correct with the following code change in 
SB/Handle/Oracle.pm:

-   $sth =  $self->SUPER::Insert( $table, 'id', $unique_id, @_);
+   my %attribs = @_;
+   $attribs{'id'} = $unique_id;
+   delete $attribs{'Id'};
+   $sth =  $self->SUPER::Insert( $table, %attribs);

I'm now getting this far in the initialize-database procedure:

[Sun Apr 13 18:02:50 2003] [crit]: RT::Handle=HASH(0xd4a6e8) couldn't 
execute the query 'INSERT INTO GroupMembers (GroupId, MemberId, id) 
VALUES (?, ?, ?)'ORA-01400: cannot insert NULL into 
("RT"."GROUPMEMBERS"."GROUPID") (DBD ERROR: OCIStmtExecute)
  (/opt/rt3/lib/RT.pm:228)
make: *** [initialize-database] Error 255

So I'm guessing that Oracle may be plagued with the same problem as Pg 
was with the empty values not being added as '0' and since the table 
specification is stating NOT NULL I'm getting that error. Any hints on 
this one?

-Brook




More information about the Rt-devel mailing list