FileField truncation/exception on path string overflow (#9893)

57 views
Skip to first unread message

akaihola

unread,
Apr 7, 2009, 4:45:54 AM4/7/09
to Django developers
Continuing the discussion from http://code.djangoproject.com/ticket/9893
here.

Summary: FileField and ImageField have a problem when the length of
the file path relative to MEDIA_ROOT exceeds 100 characters (or the
overridden max_length). I get a 500 server error (with PostgreSQL) and
the original reporter of #9893 had the path truncated in the db
(engine unknown).

wwinham raised the question whether there would be any drawbacks in
changing FileField to a text field instead of varchar. I can't think
of any in the environments my projects use, but could some database
engines have scalability issues with regarding performance or memory/
disk consumption?

Shai Berger

unread,
Apr 7, 2009, 6:19:25 AM4/7/09
to django-d...@googlegroups.com
On Tuesday 07 April 2009 11:45:54 akaihola wrote:
> Continuing the discussion from http://code.djangoproject.com/ticket/9893
> here.
>
> Summary: FileField and ImageField have a problem when the length of
> the file path relative to MEDIA_ROOT exceeds 100 characters (or the
> overridden max_length). I get a 500 server error (with PostgreSQL) and
> the original reporter of #9893 had the path truncated in the db
> (engine unknown).

(probably mysql; has been known to misbehave like this)

>
> wwinham raised the question whether there would be any drawbacks in
> changing FileField to a text field instead of varchar. I can't think
> of any in the environments my projects use, but could some database
> engines have scalability issues with regarding performance or memory/
> disk consumption?

In many engines, text fields are kept out-of-table; then, what's kept in the
table, is (effectively) the name of a file where the text is kept. Even if
this doesn't seriously affect performance, using such a field to keep a
filename must raise a few eyebrows.


Reply all
Reply to author
Forward
0 new messages