Hello Everyone. Is there a way to limit varchar le...
# help
j
Hello Everyone. Is there a way to limit varchar length in supabase? I want to limit server side.
n
Hello @JR23! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! 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.
g
You can set up your column with a length, UI does not support, but you can use SQL editor: ALTER TABLE YourTable ALTER COLUMN YourColumn VARCHAR (50) NOT NULL;
n
JR23 (2022-03-29)
g
You might also consider using a Postgres check on the column if you are just trying to enforce a max length. This is a bit easier to change at a later time, but is slightly slower than setting the length right in the varchar. There is not a real advantage in Postgres to worry about length of varchar for performance or space otherwise. https://www.postgresql.org/docs/current/datatype-character.html
j
@User thanks gary. I know how to do this in Mysql, but postgres is new to me.
I saw that there is no real problem with this in postgresql but if someone bypass javascript , one title that should be only 50 characters (example), will have a really long length and its not cool
for the password will be the same, I suppose?!
g
Yes that is only reason to use the length or a check
j
@User thanks again.
n
Thread was archived by @JR23. Anyone can send a message to unarchive it.