If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

The flags.setter_id DB column cannot be NULL

RESOLVED FIXED in Bugzilla 4.0

Status

()

Bugzilla
Database
RESOLVED FIXED
8 years ago
7 years ago

People

(Reporter: Frédéric Buclin, Assigned: Frédéric Buclin)

Tracking

Bugzilla 4.0
Bug Flags:
approval +
approval4.0 +

Details

Attachments

(1 attachment, 1 obsolete attachment)

1.68 KB, patch
Max Kanat-Alexander
: review+
Details | Diff | Splinter Review
(Assignee)

Description

8 years ago
A flag always has a setter. The DB should enforce this (it already has a FK pointing to profiles.userid). NOTNULL => 1 is missing.

Comment 1

8 years ago
Isn't it NULL when there's only a requester and no responder?
(Assignee)

Comment 2

8 years ago
No idea what a responder is. Do you mean requestee? A flag has two user fields, one setter/requester (flags.setter_id, which must always be set), and the requestee (flags.requestee_id).

Comment 3

8 years ago
By responder I mean the person who grants +/-. I thought that if you just requested a flag, then requester_id was set, but setter_id was not.
(Assignee)

Comment 4

8 years ago
Max, I wrote:

 $dbh->bz_alter_column('flags', 'setter_id', {TYPE => 'INT3', NOTNULL => 1});

but Pg crashes with:

Adding foreign key: flags.setter_id -> profiles.userid...
DBD::Pg::db do failed: ERROR:  constraint « fk_flags_setter_id_profiles_userid » for table « flags » already exists at Bugzilla/DB.pm line 515
        Bugzilla::DB::bz_add_fk('Bugzilla::DB::Pg=HASH(0xa2e6130)', 'flags', 'setter_id', 'HASH(0xa342250)') called at Bugzilla/DB.pm line 450
        Bugzilla::DB::bz_setup_foreign_keys('Bugzilla::DB::Pg=HASH(0xa2e6130)') called at Bugzilla/Install/DB.pm line 593
        Bugzilla::Install::DB::update_table_definitions('HASH(0x8a847b0)') called at ./checksetup.pl line 192
 at Bugzilla/DB.pm line 515
        Bugzilla::DB::bz_add_fk('Bugzilla::DB::Pg=HASH(0xa2e6130)', 'flags', 'setter_id', 'HASH(0xa342250)') called at Bugzilla/DB.pm line 450
        Bugzilla::DB::bz_setup_foreign_keys('Bugzilla::DB::Pg=HASH(0xa2e6130)') called at Bugzilla/Install/DB.pm line 593
        Bugzilla::Install::DB::update_table_definitions('HASH(0x8a847b0)') called at ./checksetup.pl line 192


Why is checksetup.pl trying to add the FK again?

Comment 5

8 years ago
(In reply to comment #4)
> Why is checksetup.pl trying to add the FK again?

  Hmm, dunnow--could be a bug. Does it still happen if you create a fresh database and then apply your patch and run checksetup again?
(Assignee)

Updated

7 years ago
Target Milestone: --- → Bugzilla 3.8

Updated

7 years ago
Whiteboard: [Good Intro Bug]
(Assignee)

Comment 6

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

OK, I cannot reproduce the error mentioned above. I was probably playing with a broken DB (due to another patch I was testing).
Assignee: database → LpSolit
Status: NEW → ASSIGNED
Attachment #482076 - Flags: review?(mkanat)
(Assignee)

Comment 7

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

Oops, I missed one file.
Attachment #482076 - Attachment is obsolete: true
Attachment #482077 - Flags: review?(mkanat)
Attachment #482076 - Flags: review?(mkanat)

Updated

7 years ago
Attachment #482077 - Flags: review?(mkanat) → review+

Updated

7 years ago
Flags: approval4.0+
Flags: approval+
(Assignee)

Comment 8

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 7532.

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