How to create case-insensitive unique constraint in Google Spanner using GoogleSql?

I want to create case-insensitive unique constraint for a column. But I am not able to figure out exact syntax for that.

I tried with this below ex query but getting syntax error.

alter table test_table_user add constraint user_name_unique unique (lower(user_name))

 
0 1 765
1 REPLY 1

For case senstive there is collate option in spanner.

You can use same query just write column name as below

my_column COLLATE utf8_bin

document - https://cloud.google.com/spanner/docs/reference/standard-sql/collation-concepts#collate_operations