-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Each adapter must implement the getIntLimit() method, but it isn't enforced due to how we interpret $size for integer attributes.
In the case of strings, $size is pretty obvious - the length of the string. However, for integers (and before BIGINT), we just set $size = 0, so this check in createAttribute() would never actually prevent PDO from throwing the database exception:
database/src/Database/Database.php
Lines 433 to 437 in af512b7
| case self::VAR_INTEGER: | |
| $limit = ($signed) ? $this->adapter->getIntLimit() / 2 : $this->adapter->getIntLimit(); | |
| if($size > $limit) { | |
| throw new Exception('Max size allowed for int is: '.number_format($limit)); | |
| } |
Options to enforce int limit:
- Check values for
getIntLimit()as a filter when creating/updating documents - Get PDO error codes when size is exceeded and throw a custom
Utopia\Databaseexception
Metadata
Metadata
Assignees
Labels
No labels