ModifyDataType generates bad practice SQL for Postgres database

Description

ModifyDataType generates SQL for postgres that is considered bad practice.
The major issue is that hides possible column content truncation.

Example:

The changelog above will generate the following SQL:

Due to the USING clause, postgres will automatically truncate the column content in case the user is reducing the column size instead of increasing it. If the SQL statement didn't have the USING clause postgres would have failed the execution with message: [22001] ERROR: value too long for type character varying(100)

Could you guys either not add the USING automatically or add a flag to avoid this bad practice. The USING clause should only be used when data casting is required or you actually want to truncate values.

https://github.com/liquibase/liquibase/blob/bce767333bd4867708a03ca5fb90df868433fb44/liquibase-core/src/main/java/liquibase/sqlgenerator/core/ModifyDataTypeGenerator.java#L66-L68

Environment

CentOS. Java 8.

Status

Reporter

Francisco Ramos da Silva

Components

Affects versions

Priority

Major
Configure