Home > OS >  Get Other Items in PSQL Array
Get Other Items in PSQL Array

Time:08-27

I see a few questions on here outlining how to use the any function to find if a value exists in an array, but I haven't found one to go the other direction. If I have a PSQL array with the values {see,tom,run,fast} and I wanted all values except run, how would I select the remaining words minus run?

CodePudding user response:

See the documentation for array functions. What you are looking for is the array_remove() function.

select array_remove(array['see','tom','run','fast'], 'run');
  • Related