https://supabase.com/ logo
How to set the default value of a column to the ro...
# help
m
How to set the default value of a column to the row id or an auto incrementing number? Can this be done with a short expression in the default value input box or does it need an SQL expression?
n
Hello @Max52! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
s
There is a Postgres type called
serial
which will give you this but we don't seem to have it in the table creation dropdown because we discourage the use of autoincremented values for primary keys. However you can create this using the SQL editor, you can read more about this on this website https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-serial/
n
Thread was archived by @Max52. Anyone can send a message to unarchive it.
n
> we discourage the use of autoincremented values for primary keys Do you recommend UUID be used instead?
s
Yes as these are harder to guess.
2 Views