Ticket #2114 (closed defect: fixed)

Opened 20 months ago

Last modified 15 months ago

database length restrictions on properties are silent

Reported by: dustin Owned by:
Priority: major Milestone: 0.8.6
Version: 0.8.4p2 Keywords: database
Cc:

Description

If you create a property that's too long, the database fails to tell you about it, and you get an error reading the JSON back. We should detect this and error out at insert/update time. See

 https://github.com/tardyp/buildbot/commit/03f8fcb35552991663a177c7ff160993741f921a

Change History

comment:1 Changed 15 months ago by dustin

I need to figure out the function for MySQL's maximum number of characters given a text limit -- I don't think it's the identity function :(

comment:2 Changed 15 months ago by dustin

Actually, in my test script, I do get a warning from msyql-python, but only the first time:

/home/dustin/code/buildbot/t/buildbot/sand26/lib/python2.6/site-packages/sqlalchemy/engine/default.py:330: Warning: Data truncated for column 't' at row 1

On the bright side, MySQL's and Python's length functions seem to agree!

comment:3 Changed 15 months ago by dustin

  • Status changed from new to closed
  • Resolution set to fixed

The trac hook failed, but this is fixed in

commit 967b74ecaf1f0bbae842534280b3e56e5d52c17f
Author: Dustin J. Mitchell <dustin@mozilla.com>
Date:   Sat Feb 25 22:59:04 2012 -0600

    check database column length on insert for MySQL
    
    SQLite ignores length and just stores all the bytes you give it.
    Postgres will kindly produce an error rather than silently truncating.
    So this support is only really useful for MySQL, and stubs itself out
    everywhere else.
    
    Fixes #2114.
Note: See TracTickets for help on using tickets.