Last Comment Bug 919475 - [Oracle] Crash when non-mandatory free text custom fields are left empty on bug creation
: [Oracle] Crash when non-mandatory free text custom fields are left empty on b...
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: Database (show other bugs)
: 4.4
: All All
: -- major (vote)
: Bugzilla 4.2
Assigned To: Jiří Netolický
: default-qa
Mentors:
: 930537 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-23 04:37 PDT by Jiří Netolický
Modified: 2013-10-24 14:29 PDT (History)
2 users (show)
justdave: approval+
justdave: approval4.4+
LpSolit: blocking4.4.1+
justdave: approval4.2+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
ora_cust_field.patch (501 bytes, patch)
2013-09-23 04:37 PDT, Jiří Netolický
LpSolit: review+
Details | Diff | Review
patch, 1.1 (504 bytes, patch)
2013-09-23 06:06 PDT, Frédéric Buclin
LpSolit: review+
Details | Diff | Review

Description Jiří Netolický 2013-09-23 04:37:14 PDT
Created attachment 808525 [details] [diff] [review]
ora_cust_field.patch

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release)
Build ID: 20130807090445

Steps to reproduce:

1. Have a Oracle database backend.
2. Create non mandatory, free text type, custom field.
3. Try to create new bug without filling this field.


Actual results:

Creation fails with this error:
Software error:
DBD::Oracle::db do failed: ORA-01400: cannot insert NULL into
("NETOLDABUG"."BUGS"."CF_TESTLINK_ID_FUNC") (DBD ERROR: error possibly near
<*> indicator at char 321 in 'INSERT INTO bugs (priority,
cf_testlink_id_func, reporter, bug_file_loc, product_id, rep_platform,
assigned_to, qa_contact, short_desc, everconfirmed, status_whiteboard,
bug_severity, bug_status, delta_ts, version, estimated_time, deadline,
component_id, target_milestone, cf_chyba_kategorie, alias, op_sys) VALUES
(:p1,:<*>p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10,:p11,:p12,:p13,:p14,:p15,:p16,:p17,:p18,:p19,:p20,:p21,:p22)')
 [for Statement "INSERT INTO bugs (priority, cf_testlink_id_func, reporter,
bug_file_loc, product_id, rep_platform, assigned_to, qa_contact,
short_desc, everconfirmed, status_whiteboard, bug_severity, bug_status,
delta_ts, version, estimated_time, deadline, component_id,
target_milestone, cf_chyba_kategorie, alias, op_sys) VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"] at Bugzilla/DB/Oracle.pm
line 385
                 Bugzilla::DB::Oracle::do(undef, 'INSERT INTO bugs (priority,
cf_testlink_id_func, reporter, bu...', undef, 'Normal', '', 13, '', 6,
'PC', ...) called at Bugzilla/Object.pm line 550
                 Bugzilla::Object::insert_create_data('Bugzilla::Bug', 'HASH
(0x29c3fe0)') called at Bugzilla/Bug.pm line 647
                 Bugzilla::Bug::create('Bugzilla::Bug', 'HASH(0x395d408)')
called at /var/www/html/bugzilla/post_bug.cgi line 129
Comment 1 Jiří Netolický 2013-09-23 04:41:34 PDT
The problem is that there is not created "notnull_trigger" by _get_notnull_trigger_ddl on the
column with this field when the filed is "NOTNULL" and have "DEFAULT" value.
Then insert failed because is inserted "null" value into "not null" column.
Attached patch resolved this issue.
Comment 2 Frédéric Buclin 2013-09-23 04:57:11 PDT
Confirmed!
Comment 3 Frédéric Buclin 2013-09-23 05:51:20 PDT
Comment on attachment 808525 [details] [diff] [review]
ora_cust_field.patch

>+        push (@sql, _get_notnull_trigger_ddl($table, $column))
>+            if $definition->{TYPE} =~ /varchar|text/i
>+               && $definition->{NOTNULL}
>+               && defined $definition->{DEFAULT};

There is no need to check if DEFAULT is set. Otherwise works fine. r=LpSolit (I will commit a slightly differently formatted patch)
Comment 4 Frédéric Buclin 2013-09-23 06:01:36 PDT
get_add_column_ddl() has been implemented in Bugzilla 4.2.3, see bug 731156. So it makes sense to fix this method on this branch too, else installations still running the 4.2 branch will continue to create text columns without the required triggers.
Comment 5 Frédéric Buclin 2013-09-23 06:06:01 PDT
Created attachment 808551 [details] [diff] [review]
patch, 1.1

Here is the patch I'm going to commit.
Comment 6 Frédéric Buclin 2013-09-23 08:45:10 PDT
Thanks for the patch, Jiří. :)

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/DB/Schema/Oracle.pm
Committed revision 8751.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/
modified Bugzilla/DB/Schema/Oracle.pm
Committed revision 8609.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/DB/Schema/Oracle.pm
Committed revision 8226.
Comment 7 Frédéric Buclin 2013-10-24 14:29:19 PDT
*** Bug 930537 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.