[Pg] Update from 4.0 or older to 4.2 or trunk fails when bug_see_also field is populated

RESOLVED FIXED in Bugzilla 4.2

Status

()

--
critical
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: wicked, Assigned: LpSolit)

Tracking

({regression})

Bugzilla 4.2
regression
Bug Flags:
approval +
approval4.2 +
blocking4.2 +

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

7 years ago
When there's anything in the bug_see_also table, an update to 4.2 or trunk fails when it tries to add the new class column introduced in bug 620827. This only fails on Pg just like the comment in http://bzr.mozilla.org/bugzilla/trunk/annotate/head:/Bugzilla/DB/Schema.pm#L2175 suggests.

Here's the relevant log from our Tinderbox (that now burns):
--!--
---------------------------------------------
Testing against database from version 3.7.2...
---------------------------------------------

* This is Bugzilla 4.3 on perl 5.8.8
* Running on Linux 2.6.18-274.7.1.el5 #1 SMP Thu Oct 20 16:21:01 EDT 2011
....
Adding new table audit_log...
Adding new table bug_tag...
Adding new table field_visibility...
Adding new table tag...
Fixing flags_id_seq to be associated with flags.id...
Fixing flagtypes_id_seq to be associated with flagtypes.id...
Fixing keyworddefs_id_seq to be associated with keyworddefs.id...
Fixing longdescs_comment_id_seq to be associated with longdescs.comment_id...
Fixing file permissions...
Populating new field_visibility table...
Deleting the 'visibility_value_id' column from the 'fielddefs' table...
Adding new column 'is_numeric' to the 'fielddefs' table...
Deleting the 'isurl' column from the 'attachments' table...
Adding new column 'isactive' to the 'components' table...
Adding new column 'isactive' to the 'versions' table...
Adding new column 'isactive' to the 'milestones' table...
Updating column setter_id in table flags ...
Old: integer
New: integer NOT NULL
Dropping foreign key: series.creator -> profiles.userid...
Dropping foreign key: series.category -> series_categories.id...
Dropping foreign key: series.subcategory -> series_categories.id...
Removing index 'series_creator_idx' from the series table...
Adding new index 'series_creator_idx' to the series table ...
Adding new index 'series_category_idx' to the series table ...
Adding new column 'id' to the 'bug_see_also' table...
Populating the new tags table:
.35/35 (100%)
Deleting the 'query_type' column from the 'namedqueries' table...
Adding new column 'class' to the 'bug_see_also' table...
DBD::Pg::db do failed: ERROR:  column "class" contains null values at Bugzilla/DB.pm line 606
	Bugzilla::DB::bz_add_column('Bugzilla::DB::Pg=HASH(0x6655690)', 'bug_see_also', 'class', 'HASH(0x9a927d0)', '') called at Bugzilla/Install/DB.pm line 3574
	Bugzilla::Install::DB::_populate_bug_see_also_class() called at Bugzilla/Install/DB.pm line 655
	Bugzilla::Install::DB::update_table_definitions('HASH(0x5086fb0)') called at ./checksetup.pl line 199
--!--

FYI, it wasn't failing before because none of the Pg test DBs contained any see also values. Older/newer Pg test DBs don't fail due to same reason. MySQL test DBs does contain see also values so it's not affected.
Flags: blocking4.2?
(Assignee)

Comment 1

7 years ago
The list will never go to zero. :-/
Flags: blocking4.2? → blocking4.2+
Target Milestone: --- → Bugzilla 4.2

Updated

7 years ago
Assignee: installation → timello

Updated

7 years ago
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(Assignee)

Comment 2

7 years ago
Created attachment 582857 [details] [diff] [review]
patch, v1

A default value is mandatory as the text field is of type NOT NULL. IMO, this is a bug in get_add_column_ddl() where $init_value should be used as default if no default is specified.
Assignee: timello → LpSolit
Attachment #582857 - Flags: review?(wicked)
(Reporter)

Comment 3

7 years ago
Comment on attachment 582857 [details] [diff] [review]
patch, v1

You also need to add the same default definition to the schema, otherwise upgraded and initially created databases end up differently.

And yes, I agree this is a bug in get_add_column_ddl() or possibly in get_type_ddl(). Especially since we know Pg and other DBs fail otherwise.
Attachment #582857 - Flags: review?(wicked) → review+
(Assignee)

Comment 4

7 years ago
Created attachment 582881 [details] [diff] [review]
patch, v1.1

Nice catch!
Attachment #582857 - Attachment is obsolete: true
(Assignee)

Updated

7 years ago
Flags: approval4.2+
Flags: approval+
(Reporter)

Updated

7 years ago
Attachment #582881 - Flags: review+
(Assignee)

Comment 5

7 years ago
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/DB/Schema.pm
modified Bugzilla/Install/DB.pm
Committed revision 8047.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/DB/Schema.pm
modified Bugzilla/Install/DB.pm
Committed revision 7985.
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.