[Answer]-Django syncdb doesn't work after invoking inspectdb

1👍

Currently inspectdb doesn’t set max_length for PostgreSQL char fields without specified length. FYI, quote from postgreSQL docs:

The notations varchar(n) and char(n) are aliases for character
varying(n) and character(n), respectively. character without length
specifier is equivalent to character(1). If character varying is used
without length specifier, the type accepts strings of any size. The
latter is a PostgreSQL extension.

But, Django doesn’t allow to define CharFields without max_length parameter. There is an open ticket for it.

This django snippet provides a custom CharField without length limit – should pass all django’s validation.

Also, switching to TextField could help too.

Hope that helps.

👤alecxe

Leave a comment