it's a int(11) which means its limit is 2^31 We have currently 29 permissions, there is only one remaining, at 31 permissions the permission system won't support a case where a patron has all permissions.
Created attachment 148952 [details] [review] Bug 33368: Extends borrowers.flags to bigint it's a int(11) which means its limit is 2^31 We have currently 29 permissions, there is only one remaining, at 31 permissions the permission system won't support a case where a patron has all permissions. Test plan: Don't apply this patch Add another permission INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (30, 'new permission 1', '', 0) ; Go to the interface, tick all the boxes select flags from borrowers where borrowernumber=5; => 2113928830 Remember: 2^31 2147483648 2^32 4294967296 Add another one INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (31, 'new permission 2', '', 0) ; Repeat the step before => boom CGI::Compile::ROOT::kohadevbox_koha_members_member_2dflags_2epl::member_2dflags_2epl(): DBI Exception: DBD::mysql::st execute failed: Out of range value for column 'flags' at row 1 at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 Apply the patch, try again QA note: That's ofc not the best solution, but the easiest for now
Created attachment 148953 [details] [review] Bug 33368: DBIC
Created attachment 148954 [details] [review] Bug 33368: Extends borrowers.flags to bigint it's a int(11) which means its limit is 2^31 We have currently 29 permissions, there is only one remaining, at 31 permissions the permission system won't support a case where a patron has all permissions. Test plan: Don't apply this patch Add another permission INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (30, 'new permission 1', '', 0) ; Go to the interface, tick all the boxes select flags from borrowers where borrowernumber=5; => 2113928830 Remember: 2^31 2147483648 2^32 4294967296 Add another one INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (31, 'new permission 2', '', 0) ; Repeat the step before => boom CGI::Compile::ROOT::kohadevbox_koha_members_member_2dflags_2epl::member_2dflags_2epl(): DBI Exception: DBD::mysql::st execute failed: Out of range value for column 'flags' at row 1 at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 Apply the patch, try again QA note: That's ofc not the best solution, but the easiest for now Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 148955 [details] [review] Bug 33368: DBIC Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 149150 [details] [review] Bug 33368: Extends borrowers.flags to bigint it's a int(11) which means its limit is 2^31 We have currently 29 permissions, there is only one remaining, at 31 permissions the permission system won't support a case where a patron has all permissions. Test plan: Don't apply this patch Add another permission INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (30, 'new permission 1', '', 0) ; Go to the interface, tick all the boxes select flags from borrowers where borrowernumber=5; => 2113928830 Remember: 2^31 2147483648 2^32 4294967296 Add another one INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (31, 'new permission 2', '', 0) ; Repeat the step before => boom CGI::Compile::ROOT::kohadevbox_koha_members_member_2dflags_2epl::member_2dflags_2epl(): DBI Exception: DBD::mysql::st execute failed: Out of range value for column 'flags' at row 1 at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 Apply the patch, try again QA note: That's ofc not the best solution, but the easiest for now Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Created attachment 149151 [details] [review] Bug 33368: DBIC Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
It works! However I don't get why because bigint(11) still has 11 for the number of digits. But it works up to at least 40 bits/flags. And MariaDB's doc doesn't have anything suspicious like the number for bigint being there for compatibility/historical reasons and not being used. https://mariadb.com/kb/en/bigint/ Anyway, second signoff added so it can still be used as a signoff and Nick can pass QA if they know the answer to the above and don't want to wait.
(In reply to Victor Grousset/tuxayo from comment #7) > It works! However I don't get why because bigint(11) still has 11 for the > number of digits. But it works up to at least 40 bits/flags. And MariaDB's > doc doesn't have anything suspicious like the number for bigint being there > for compatibility/historical reasons and not being used. > https://mariadb.com/kb/en/bigint/ > > Anyway, second signoff added so it can still be used as a signoff and Nick > can pass QA if they know the answer to the above and don't want to wait. (11) i.e. the 'display width' is not relevant to the storage size, which is the problem here. Any INT data type will have the same known limit. It is only relevant if you define things like zero padding, and then you know it will fill with zeroes up to 11 digits. For reference: https://dev.mysql.com/doc/refman/5.7/en/numeric-type-syntax.html#:~:text=The%20maximum%20display%20width%20is,digits%20that%20can%20be%20stored.
Created attachment 149239 [details] [review] Bug 33368: Extends borrowers.flags to bigint it's a int(11) which means its limit is 2^31 We have currently 29 permissions, there is only one remaining, at 31 permissions the permission system won't support a case where a patron has all permissions. Test plan: Don't apply this patch Add another permission INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (30, 'new permission 1', '', 0) ; Go to the interface, tick all the boxes select flags from borrowers where borrowernumber=5; => 2113928830 Remember: 2^31 2147483648 2^32 4294967296 Add another one INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (31, 'new permission 2', '', 0) ; Repeat the step before => boom CGI::Compile::ROOT::kohadevbox_koha_members_member_2dflags_2epl::member_2dflags_2epl(): DBI Exception: DBD::mysql::st execute failed: Out of range value for column 'flags' at row 1 at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 Apply the patch, try again QA note: That's ofc not the best solution, but the easiest for now Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 149240 [details] [review] Bug 33368: DBIC Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 23.05. Nice work everyone, thanks!
(In reply to Tomás Cohen Arazi from comment #8) > (11) i.e. the 'display width' ok!!! Now I really get this part from MariaDB's doc: «If a column has been set to ZEROFILL, all values will be prepended by zeros so that the BIGINT value contains a number of M digits.» > is not relevant to the storage size, I though it was to have some business domain rules enforced in the DB so it was on top of storage constraints. > For reference: > https://dev.mysql.com/doc/refman/5.7/en/numeric-type-syntax.html#:~: > text=The%20maximum%20display%20width%20is,digits%20that%20can%20be%20stored. thanks, it's clearer
Nice work, thanks everyone! Pushed to 22.11.x for the next release.