Create column of type double precision[] with liquibase

How to create column of type double precision[] (array of doubles) with liquibase in postgresql database?

<changeSet id="add t_name table"> <createTable tableName="t_name"> ... <column name="doubleArray" type="???"/> ... </createTable> </changeSet>

Google didn't help, please, if someone knows a solution, I will be very appreciative.


I finally found the answer with help of my colleague. It seems that liquibase don't know such types, so we need to modify sql query manually:

<createTable tableName="t_name"> ... <column name="doubleArray" type="DOUBLE_ARRAY"/> ... </createTable> <modifySql dbms="postgresql"> <replace replace="DOUBLE_ARRAY" with="double precision[][]"/> </modifySql>


Liquibase 3.3.0 is able to generate precision for double type. e.g. "type=double precision[16][2]" generates double(16,2) in mysql.


If you rely on Postgresql, you can use the float8 built-in alias:

<column name="doubleArray" type="float8[]"/>

人吐槽 人点赞



用户名: 密码:
验证码: 匿名发表


查看评论:Create column of type double precision[] with liquibase