Closed Bug 919475 Opened 11 years ago Closed 11 years ago

[Oracle] Crash when non-mandatory free text custom fields are left empty on bug creation

Categories

(Bugzilla :: Database, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: netolish, Assigned: netolish)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch ora_cust_field.patch (obsolete) — Splinter Review
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
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.
Confirmed!
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Non mandatory custom fields in Oracle → [Oracle] Crash when non-mandatory free text custom fields are left empty on bug creation
Target Milestone: --- → Bugzilla 4.4
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)
Attachment #808525 - Flags: review+
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.
Assignee: database → netolish
Status: NEW → ASSIGNED
Flags: blocking4.4.1+
Flags: approval?
Flags: approval4.4?
Flags: approval4.2?
Target Milestone: Bugzilla 4.4 → Bugzilla 4.2
Attached patch patch, 1.1Splinter Review
Here is the patch I'm going to commit.
Attachment #808525 - Attachment is obsolete: true
Attachment #808551 - Flags: review+
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval4.2?
Flags: approval4.2+
Flags: approval+
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.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: