DEV Community

Discussion on: Supabase/Postgres SQL Cheatsheet - Curated List of SQL

Collapse
 
vbilopav profile image
vbilopav

Your Create function that return table snippet doesn't have to use plpgsql, it can be written much simpler with only SQL ,like this:

create or replace function get_tags (tag text)
returns setof products_view
language sql
as
$$
select * from products_view where tag % any(categories);
$$

Collapse
 
zernonia profile image
Zernonia

Yup you are right! Thank you for pointing it out! 🙌