DEV Community

Cover image for Supabase/Postgres SQL Cheatsheet - Curated List of SQL
Zernonia
Zernonia

Posted on • Updated on • Originally published at zernonia.com

Supabase/Postgres SQL Cheatsheet - Curated List of SQL

Hey!

If you are a PostgreSQL user, you are missing out on Big Thing!!! You could spin up a Backend Server, with PostgreSQL as Database in just 2 minutes! How? That is using Supabase. Supabase has raised 30 million as an Open Source Backend-as-a-Service (BaaS) startup. Mind blown!!!! ๐Ÿคฏ

Supabase raised 30 million

ย 

Built on Top, problem?

Postgres 13 with Supabase
Supabase is indeed build on top of Postgres, and thus enabled developers to utilize all the awesome and stable extension/scripts that has been around the industry for years! You agree with me... right? ๐Ÿ˜‚

Because of the continuous updates by Postgres (and I heard v14 is drawing near!), many of the scripts on Stackoverflow has outdated, and causes Supabase users, including myself (which switch from Firebase - NoSQL) to encounter some problem when running SQL query. Thus, we need Postgres expert like you to give Supabase a try, and join the Supabase community, Discord and most importantly make Open Source better!

ย 

Solution - Cheatsheets

Supabase SQL

Due to the reason mentioned previously, I've curated some of the SQL scripts, to aid Supabase users, or Postgres users in finding the relevant, up-to-date, and tested SQL scripts.

Where's the list, here it is!!!! -> Supabase SQL ๐ŸŽ‰๐Ÿ™Œ

If you - find it useful, please spare a ๐ŸŒŸ at the Github Repo
If you - found any issue/bug, create issues is much appreciated.
If you - wanted to contribute the SQL scripts, PR is even more welcomed!

ย 

That's it

That's all the good news I wanna share with you today. If you are a Supabase user, hope you'll like it. If you are a Postgres user, I hope you'll give Supabase a try. If you are none of the above, then you are really missing out on GREAT things!

Until next time, bye! ๐Ÿ‘‹

ย 

Follow me

๐Ÿค Bird app - @zernonia

Top comments (2)

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! ๐Ÿ™Œ