Back to Browse

Call Postgres functions from JavaScript with RPC

19.6K views
Jan 4, 2022
15:35

For the introductory video on PostgreSQL functions, check out πŸ‘‰ https://www.youtube.com/watch?v=MJZCCpCYEqk Sometimes we have a collection of complex steps we need to perform in a particular sequence from the front-end. Maybe we want to execute an SQL statement that the supabase-js library does not yet support. These are both excellent use cases for RPC. RPC in supabase allows us to call a PostgreSQL function from JavaScript. This means we can abstract away our complex logic, or multi-step process into a Postgres function, and just make one request to call this function from the client. In this video, Jon Meyers (https://twitter.com/jonmeyers_io) demonstrates how we can create a function to increment a column's value by one, and call this when the user clicks a button using RPC. This is part of a series of videos about functions in PostgreSQL, check out the rest of the playlist to learn more: https://www.youtube.com/playlist?list=PL5S4mPUpp4OtkMYxAxNpEuuDQuI2pWF3- πŸ’° Get really good at Supabase and build a SaaS product (free course): https://egghead.io/courses/build-a-saas-product-with-next-js-supabase-and-stripe-61f2bc20 --- Learn more about Supabase πŸ‘‡ πŸ•Έ Website: https://supabase.com/ 🏁 Get started: https://app.supabase.com/ πŸ“„ Docs: https://supabase.com/docs πŸ™ Github: https://github.com/supabase πŸ’¬ Discord: https://discord.supabase.com/ 🐦 Twitter: https://twitter.com/supabase/ Jon Meyers πŸ‘‡ πŸ•Έ Website: https://jonmeyers.io/ πŸŽ₯ YouTube Channel: https://www.youtube.com/c/jonmeyers 🐦 Twitter: https://twitter.com/jonmeyers_io ---

Download

1 formats

Video Formats

360pmp422.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Call Postgres functions from JavaScript with RPC | NatokHD