r/badcode • • Oct 06 '21

sql So umm this is from Twitch source code leak . NSFW

Post image
2.9k Upvotes

400 comments sorted by

View all comments

Show parent comments

8

u/RedditAcc-92975 Oct 06 '21

Create table "banned_username_patterns" ...

now in PostgreSQL there are a few ways. For example

select any (select ue.login ~ t.pattern from banned_username_patterns as t)

https://stackoverflow.com/a/13565021


Also, as others have mentioned this shouldn't be done on the DB. No need for using the database here. Unless someone was post-hock banning users.

1

u/recycle4science Oct 07 '21

See! I knew Postgres would have a better way.