Skip to content

Commit 390fe95

Browse files
committed
Update field length handling in DatabaseIntrospection
1 parent c357496 commit 390fe95

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

django_iris/introspection.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from django.db.models import Index
77
from django.utils.datastructures import OrderedSet
88

9+
MAXLEN = 65535
10+
911
FieldInfo = namedtuple(
1012
'FieldInfo', BaseFieldInfo._fields + ('auto_increment', ))
1113

@@ -94,10 +96,9 @@ def get_table_description(self, cursor, table_name):
9496
description = [
9597
FieldInfo(
9698
name,
97-
'longvarchar'
98-
if data_type == 'varchar' and length == '-1' else data_type,
99-
None,
100-
length,
99+
'longvarchar' if data_type == 'varchar' and length == '-1' else data_type,
100+
MAXLEN if not isinstance(length, int) or data_type != 'varchar' else length,
101+
MAXLEN if not isinstance(length, int) or data_type != 'varchar' else length,
101102
precision,
102103
scale,
103104
isnull == 'YES',

0 commit comments

Comments
 (0)