Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error - category_id out of SMALLINT(5) range #2137

Open
MikeImbar opened this issue Mar 18, 2024 · 0 comments
Open

SQL error - category_id out of SMALLINT(5) range #2137

MikeImbar opened this issue Mar 18, 2024 · 0 comments

Comments

@MikeImbar
Copy link

Hello,

I am getting this error:

Fatal error: Uncaught mysqli_sql_exception: Out of range value for column 'category_id' at row 1 in /srv/hfr-internal/include/dblayer/functions_mysqli.inc.php:132 Stack trace: #0 /srv/hfr-internal/include/dblayer/functions_mysqli.inc.php(132): mysqli->query() #1 /srv/hfr-internal/include/functions.inc.php(533): pwg_query() #2 /srv/hfr-internal/index.php(723): pwg_log() #3 {main} thrown in /srv/hfr-internal/include/dblayer/functions_mysqli.inc.php on line 132

The problem is that the category_id type table is SMALLINT(5) SIGNED. That gives me a range of -32768 to 32767. My max category id value is 38738, so above that range.

If I am logged in as an admin I get no message, probably because pwg_log() doesn't record admin activity to the piwigo_history table? However, if I am logged in as a normal user I see the error at the bottom of the page. In addition, the thumbnail doesn't show up and I can't open the image (while everything works if I am an admin).

The solution seems somewhat simple - I just changed the attribute to UNSIGNED. I am not sure having it SIGNED confers any benefits given that half of that range is not usable for us (we don't have categories with negative category_ids). But not sure it is the optimal solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant