Closed Bug 687247 Opened 13 years ago Closed 13 years ago

Bugzilla crashes when creating a new flagtype on PostgreSQL

Categories

(Bugzilla :: Administration, task)

4.1.3
task
Not set
critical

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file)

Due to the refactoring in bug 523205, creating a new flagtype on PostgreSQL crashes with: DBD::Pg::db do failed: ERROR: value too long for type character(1) [for Statement "INSERT INTO flagtypes (grant_group_id, request_group_id, sortkey, name, description, cc_list, is_requestable, is_multiplicable, is_requesteeble, is_active, target_type) VALUES (?,?,?,?,?,?,?,?,?,?,?)"] at Bugzilla/Object.pm line 552 Bugzilla::Object::insert_create_data('Bugzilla::FlagType', 'HASH(0x8c1b1e0)') called at Bugzilla/FlagType.pm line 128 Bugzilla::FlagType::create('Bugzilla::FlagType', 'HASH(0x95e59d8)') called at /var/www/html/bugzilla_qa42/editflagtypes.cgi line 291 The reason is that target_type returns 'bug' or 'attachment' while the DB expects to get a single character 'b' or 'a'. MySQL doesn't crash, because it inserts as much data as possible, i.e. the first character. PostgreSQL just rejects a too long string and fails.
Flags: blocking4.2+
Attached patch patch, v1Splinter Review
r=me as module owner.
Attachment #560796 - Flags: review+
Flags: approval4.2+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/FlagType.pm Committed revision 7962. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/ modified Bugzilla/FlagType.pm Committed revision 7930.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment on attachment 560796 [details] [diff] [review] patch, v1 Review of attachment 560796 [details] [diff] [review]: ----------------------------------------------------------------- ::: Bugzilla/FlagType.pm @@ +118,5 @@ > > $class->check_required_create_fields(@_); > my $params = $class->run_create_validators(@_); > + # In the DB, only the first character of the target type is stored. > + $params->{target_type} = substr($params->{target_type}, 0, 1); FWIW, the validator should be doing that.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: