Skip to content

Array type default value doesnt work. PostgreSQL #1532

@CocaColaBear

Description

@CocaColaBear

Issue type:

[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] sqlite
[ ] sqljs
[ ] websql

TypeORM version:

[ ] latest
[x] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:
My entity column:

@Column("float4", {
	array: true,
	default: [ 0.0, 0.0, 0.0 ],
	nullable: false
})
public testFloatArray: number[];

This generate query:

ALTER TABLE "public"."test" ADD "testFloatArray" real array NOT NULL DEFAULT '[0,0,0]'

And i got an error: error: malformed array literal: "[0,0,0]
The PostgresSQL syntax should be:

ALTER TABLE "public"."test" ADD "testFloatArray" real array NOT NULL DEFAULT '{0,0,0}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions