Fix an issue when changing the length of a column in the table dialogue. Fixes #1669

This commit is contained in:
Surinder Kumar 2016-09-16 11:09:13 +01:00 committed by Dave Page
parent 2f32427c59
commit 1ce5b38f4a
2 changed files with 6 additions and 7 deletions

View File

@ -8,13 +8,12 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Alter column type and collation ###}
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen and data.attlen != o_data.attlen) or (data.attprecision and data.attprecision != o_data.attprecision) %}
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen and data.attlen != o_data.attlen) or (data.attprecision or data.attprecision != o_data.attprecision) %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} TYPE {% if data.cltype %}{{conn|qtTypeIdent(data.cltype)}} {% else %}{{conn|qtTypeIdent(o_data.cltype)}} {% endif %}
{% if data.attlen %}({{data.attlen}}{% elif not data.cltype %}({{o_data.attlen}}{% endif %}{% if data.attprecision%}, {{data.attprecision}}){% elif not data.cltype %}, {{o_data.attprecision}}){% elif data.attlen %}){% endif %}{% if data.hasSqrBracket %}
{% if data.attlen and data.attlen != 'None' %}({{data.attlen}}{% if data.attlen != 'None' and data.attprecision %}, {{data.attprecision}}){% elif (data.cltype is defined and not data.cltype) %}, {{o_data.attprecision}}){% elif data.attlen %}){% endif %}{% endif %}{% if data.hasSqrBracket %}
[]{% endif %}{% if data.collspcname and data.collspcname != o_data.collspcname %}
COLLATE {{data.collspcname}}{% endif %};
{% endif %}
{### Alter column default value ###}
{% if data.defval and data.defval != o_data.defval %}
@ -145,4 +144,4 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}

View File

@ -8,10 +8,10 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Alter column type and collation ###}
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen and data.attlen != o_data.attlen) or (data.attprecision and data.attprecision != o_data.attprecision) %}
{% if (data.cltype and data.cltype != o_data.cltype) or (data.attlen and data.attlen != o_data.attlen) or (data.attprecision or data.attprecision != o_data.attprecision) %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} TYPE {% if data.cltype %}{{conn|qtTypeIdent(data.cltype)}} {% else %}{{conn|qtTypeIdent(o_data.cltype)}} {% endif %}
{% if data.attlen %}({{data.attlen}}{% elif not data.cltype %}({{o_data.attlen}}{% endif %}{% if data.attprecision%}, {{data.attprecision}}){% elif not data.cltype %}, {{o_data.attprecision}}){% elif data.attlen %}){% endif %}{% if data.hasSqrBracket %}
{% if data.attlen and data.attlen != 'None' %}({{data.attlen}}{% if data.attlen != 'None' and data.attprecision %}, {{data.attprecision}}){% elif (data.cltype is defined and not data.cltype) %}, {{o_data.attprecision}}){% elif data.attlen %}){% endif %}{% endif %}{% if data.hasSqrBracket %}
[]{% endif %}{% if data.collspcname and data.collspcname != o_data.collspcname %}
COLLATE {{data.collspcname}}{% endif %};
{% endif %}
@ -142,4 +142,4 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}