Skip to content

Instantly share code, notes, and snippets.

@felipsmartins
Created February 13, 2023 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipsmartins/cca15b269acfb981218f09a011fe63e8 to your computer and use it in GitHub Desktop.
Save felipsmartins/cca15b269acfb981218f09a011fe63e8 to your computer and use it in GitHub Desktop.
mysql max int sql_mode
MySQL [xxx]> desc teste;
+----------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------+------+-----+---------+-------+
| int_positivo | int(10) unsigned | YES | | NULL | |
| int_sinalizado | int(11) | YES | | NULL | |
+----------------+------------------+------+-----+---------+-------+
2 rows in set (0,003 sec)
MySQL [xxx]> set sql_mode = 'STRICT_TRANS_TABLES';
Query OK, 0 rows affected (0,000 sec)
MySQL [xxx]> insert into teste (int_sinalizado, int_positivo) values (-30, 4294967296);
ERROR 1264 (22003): Out of range value for column 'int_positivo' at row 1
MySQL [xxx]> set sql_mode = '';
Query OK, 0 rows affected (0,000 sec)
MySQL [xxx]> insert into teste (int_sinalizado, int_positivo) values (-30, 4294967296);
Query OK, 1 row affected, 1 warning (0,005 sec)
MySQL [xxx]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment