The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in Bugzilla 4.2

Status

()

Bugzilla
Database
--
major
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Jiří Netolický, Assigned: Jiří Netolický)

Tracking

Bugzilla 4.2
Bug Flags:
approval +
approval4.4 +
blocking4.4.1 +
approval4.2 +

Details

Attachments

(1 attachment, 1 obsolete attachment)

504 bytes, patch
Frédéric Buclin
: review+
Details | Diff | Splinter Review
(Assignee)

Description

4 years ago
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
(Assignee)

Comment 1

4 years ago
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

4 years ago
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 3

4 years ago
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+

Comment 4

4 years ago
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

Comment 5

4 years ago
Created attachment 808551 [details] [diff] [review]
patch, 1.1

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+

Comment 6

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → FIXED

Updated

4 years ago
Duplicate of this bug: 930537
You need to log in before you can comment on or make changes to this bug.