changeset a30e5d9566a6 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=a30e5d9566a6
description:
Only test column varchar size when set
issue10276
review338071003
diffstat:
trytond/backend/postgresql/table.py | 2 +-
trytond/backend/sqlite/table.py | 2 +-
trytond/backend/table.py | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diffs (37 lines):
diff -r a9f44bf77a89 -r a30e5d9566a6 trytond/backend/postgresql/table.py
--- a/trytond/backend/postgresql/table.py Tue Apr 13 12:06:56 2021 +0200
+++ b/trytond/backend/postgresql/table.py Tue Apr 13 14:22:48 2021 +0200
@@ -237,7 +237,7 @@
database = Transaction().database
base_type = database.sql_type(type_).base.upper()
- if base_type == 'VARCHAR':
+ if base_type == 'VARCHAR' and (size is None or size >= 0):
same_size = self._columns[column_name]['size'] == size
else:
same_size = True
diff -r a9f44bf77a89 -r a30e5d9566a6 trytond/backend/sqlite/table.py
--- a/trytond/backend/sqlite/table.py Tue Apr 13 12:06:56 2021 +0200
+++ b/trytond/backend/sqlite/table.py Tue Apr 13 14:22:48 2021 +0200
@@ -185,7 +185,7 @@
database = Transaction().database
base_type = database.sql_type(type_).base.upper()
- if base_type == 'VARCHAR':
+ if base_type == 'VARCHAR' and (size is None or size >= 0):
same_size = self._columns[column_name]['size'] == size
else:
same_size = True
diff -r a9f44bf77a89 -r a30e5d9566a6 trytond/backend/table.py
--- a/trytond/backend/table.py Tue Apr 13 12:06:56 2021 +0200
+++ b/trytond/backend/table.py Tue Apr 13 14:22:48 2021 +0200
@@ -91,7 +91,8 @@
:param column_name: the column name
:param type_: the generic name of the type
:param size: if `type` is VARCHAR you can specify its size.
- Defaults to -1 which will won't match any size
+ Use a negative value to ignore the size check.
+ Defaults to -1
:return: a boolean
'''
raise NotImplementedError