[Koha-bugs] [Bug 32556] borrower_message_preference_id reaches limit

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jan 4 16:57:13 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32556

--- Comment #6 from Galen Charlton <gmcharlt at gmail.com> ---
As a side note, I ran across this query that identifies cases where an
auto_increment column is at risk of hitting its maximum value:

SELECT
  c.TABLE_CATALOG,
  c.TABLE_SCHEMA,
  c.TABLE_NAME,
  c.COLUMN_NAME
FROM information_schema.COLUMNS AS c
JOIN information_schema.TABLES AS t USING (TABLE_CATALOG, TABLE_SCHEMA,
TABLE_NAME)
WHERE c.EXTRA LIKE '%auto_increment%'
  AND t.AUTO_INCREMENT / CASE c.DATA_TYPE
      WHEN 'TINYINT' THEN IF(c.COLUMN_TYPE LIKE '% UNSIGNED', 255, 127)
      WHEN 'SMALLINT' THEN IF(c.COLUMN_TYPE LIKE '% UNSIGNED', 65535, 32767)
      WHEN 'MEDIUMINT' THEN IF(c.COLUMN_TYPE LIKE '% UNSIGNED', 16777215,
8388607)
      WHEN 'INT' THEN IF(c.COLUMN_TYPE LIKE '% UNSIGNED', 4294967295,
2147483647)
      WHEN 'BIGINT' THEN IF(c.COLUMN_TYPE LIKE '% UNSIGNED',
'18446744073709551615', 9223372036854775807) # need to quote because column
type defaults to unsigned.
      ELSE 0
    END > .9; # 10% buffer

Source: https://stackoverflow.com/a/45171880

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list