https://supabase.com/ logo
Custom Column Data Type Values?
e

Evostance

05/25/2023, 2:01 PM
I want to setup an autogenerated ID for each of my table rows, however I'd like them to be in a certain format. Something like
FEXXXXXXXXXX
where X is an alphanumerical character. Is there a way I can put this as an expression in the Default Value?
g

garyaustin

05/25/2023, 2:09 PM
https://stackoverflow.com/questions/29257284/how-to-create-alpha-numeric-sequences-in-postgresql I just googled
postgres create sequence for primary key with alphanumeric
there were many hits.
e

Evostance

05/25/2023, 2:11 PM
Yeah I've been reading these, just wondering how to get it into supabase
g

garyaustin

05/25/2023, 2:11 PM
You use the SQL they show in the SQL editor. Of course with your column and table names. You might be able to enter it in the Table UI for default, but you would still need to set up the sequence in SQL. I really don't use the default option in the UI much except for null, or auth.uid() so not sure what all it can do versus altering the table in SQL.
e

Evostance

05/25/2023, 2:33 PM
Ahhh ok!"