sql - Empty array as PostgreSQL array column default value -


i have defined array field in postgresql 9.4 database:

character varying(64)[] 

can have empty array e.g. {} default value of field? syntax setting so?

i'm getting following error in case of setting brackets {}:

sql error:  error:  syntax error @ or near "{" line 1: ...public"."accounts" alter column "pwd_history" set default {}                                                                      ^  in statement: alter table "public"."accounts" alter column "pwd_history" set default {} 

you need use explicit array initializer , cast correct type:

alter table public.accounts      alter column pwd_history set default array[]::varchar[]; 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -