9559
![Create column of type double precision[] with liquibase](https://www.xszz.org/skin/wt/rpic/t18.jpg)
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.
Answer1:
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>
Answer2:
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.
Answer3:
If you rely on Postgresql, you can use the float8
built-in alias:
<column name="doubleArray" type="float8[]"/>