{"action":"closed","issue":{"url":"https://api.github.com/repos/coleifer/peewee/issues/1818","repository_url":"https://api.github.com/repos/coleifer/peewee","labels_url":"https://api.github.com/repos/coleifer/peewee/issues/1818/labels{/name}","comments_url":"https://api.github.com/repos/coleifer/peewee/issues/1818/comments","events_url":"https://api.github.com/repos/coleifer/peewee/issues/1818/events","html_url":"https://github.com/coleifer/peewee/issues/1818","id":393637118,"node_id":"MDU6SXNzdWUzOTM2MzcxMTg=","number":1818,"title":"SQLite not respecting CharField or FixedCharField max_length","user":{"login":"stigok","id":952936,"node_id":"MDQ6VXNlcjk1MjkzNg==","avatar_url":"https://avatars2.githubusercontent.com/u/952936?v=4","gravatar_id":"","url":"https://api.github.com/users/stigok","html_url":"https://github.com/stigok","followers_url":"https://api.github.com/users/stigok/followers","following_url":"https://api.github.com/users/stigok/following{/other_user}","gists_url":"https://api.github.com/users/stigok/gists{/gist_id}","starred_url":"https://api.github.com/users/stigok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stigok/subscriptions","organizations_url":"https://api.github.com/users/stigok/orgs","repos_url":"https://api.github.com/users/stigok/repos","events_url":"https://api.github.com/users/stigok/events{/privacy}","received_events_url":"https://api.github.com/users/stigok/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-22T02:57:25Z","updated_at":"2018-12-22T16:50:39Z","closed_at":"2018-12-22T16:50:39Z","author_association":"NONE","body":"```python\r\nfrom peewee import *\r\n\r\ndatabase = SqliteDatabase(':memory:')\r\n\r\nclass User(Model):\r\n    class Meta:\r\n        database = database\r\n    username = CharField(max_length=21)\r\n\r\ndatabase.create_tables([User])\r\n\r\nusername = 'a' * 42\r\nassert len(username) == 42\r\n\r\nu = User.create(username=username)\r\nassert u.username == username\r\n\r\nu = User.get(username=username)\r\nassert u.username == username\r\n```\r\nNothing special happens when attempting to insert values of length > `max_length` into fields of type `CharField` or `FixedCharField`. Reading the code, I can not find any validation steps performed for respecting `max_length` either.\r\n\r\nI was expecting an exception to be raised due to [docs stating](http://docs.peewee-orm.com/en/latest/peewee/api.html#CharField)\r\n> Values that exceed length are not truncated automatically."}}
{"actor":{"display_login":"coleifer"}}