1

I have a text array that's storing unique file urls. Is there a way to insert a url and ignore duplicate?

1 Answer 1

1

Storing URLs that you want to be unique in a text[] array is a really bad idea, but since you asked.

update my_table
   set file_urls = file_urls||'new_file_url_here'
 where id = <id>
   and not 'new_file_url_here' = any(file_urls)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Yes I know :(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.