Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Updating stored procedures

Copple696857c678e9
diff --git a/web/docs/common/DummyData.mdx b/web/docs/common/DummyData.mdx
index f7416d79cc0..e02777a1db3 100644
--- a/web/docs/common/DummyData.mdx
+++ b/web/docs/common/DummyData.mdx
@@ -1,4 +1,11 @@
+import Collapsable from '../../src/components/Collapsable'
+
+<Collapsable title="Toggle Example Tables">
+
+We will be fictional "world" database in all of our examples.
+
+
<div className="DummyData">
<div className="">
<strong>Countries</strong>
@@ -27,3 +34,5 @@
</div>
</div>
+
+</Collapsable>
\ No newline at end of file
diff --git a/web/docs/library/delete.mdx b/web/docs/library/delete.mdx
index 84e2ab56aa4..5615d75320f 100644
--- a/web/docs/library/delete.mdx
+++ b/web/docs/library/delete.mdx
@@ -3,7 +3,6 @@ id: delete
title: 'Deleting'
---
-
import DummyData from '../common/DummyData.mdx'
import Collapsable from '../../src/components/Collapsable'
import CommonResponses from '../common/CommonResponses.mdx'
@@ -11,12 +10,9 @@ import CommonFilters from '../common/CommonFilters'
import FromFunction from '../common/FromFunction.mdx'
-We will be using these tables as reference for our examples:
-
<DummyData />
-
### Delete records
This example how to delete a city:
diff --git a/web/docs/library/get.mdx b/web/docs/library/get.mdx
index 6d1c08d900b..18d14de2d3c 100644
--- a/web/docs/library/get.mdx
+++ b/web/docs/library/get.mdx
@@ -11,7 +11,6 @@ import Collapsable from '../../src/components/Collapsable'
import FromFunction from '../common/FromFunction.mdx'
import DummyData from '../common/DummyData.mdx'
-We will be using these tables as reference for our examples:
<DummyData />
diff --git a/web/docs/library/patch.mdx b/web/docs/library/patch.mdx
index 01ba8af1977..0ddcf53f646 100644
--- a/web/docs/library/patch.mdx
+++ b/web/docs/library/patch.mdx
@@ -10,9 +10,6 @@ import CommonResponses from '../common/CommonResponses.mdx'
import CommonFilters from '../common/CommonFilters'
import FromFunction from '../common/FromFunction.mdx'
-
-We will be using these tables as reference for our examples:
-
<DummyData />
### Update record
diff --git a/web/docs/library/post.mdx b/web/docs/library/post.mdx
index d8c59636ff1..70c2d968313 100644
--- a/web/docs/library/post.mdx
+++ b/web/docs/library/post.mdx
@@ -10,12 +10,9 @@ import CommonResponses from '../common/CommonResponses.mdx'
import FromFunction from '../common/FromFunction.mdx'
-We will be using these tables as reference for our examples:
-
<DummyData />
-
### Create a record
This example how to create a new city:
diff --git a/web/docs/library/stored-procedures.mdx b/web/docs/library/stored-procedures.mdx
index 6c5477d82e2..4226da7e8e9 100644
--- a/web/docs/library/stored-procedures.mdx
+++ b/web/docs/library/stored-procedures.mdx
@@ -8,7 +8,10 @@ import CommonFilters from '../common/CommonFilters'
import CommonResponses from '../common/CommonResponses.mdx'
import DummyData from '../common/DummyData.mdx'
-We will be using these tables as reference for our examples:
+You can call stored procedures as a "Remote Procedure Call".
+
+That's just a fancy way of saying that you can put some logic into your database, and then call it from anywhere.
+This is especially useful for things like password resets, where the logic rarely changes.
<DummyData />
@@ -43,7 +46,7 @@ const echoCity = async () => {
### Bulk call
-This example shows how to call a stored function that takes in a names of cities and returns them:
+This example would call a the same stored procedure above (twice), but it will also wait to receive the response only when all the calls have completed:
<!-- prettier-ignore -->
```js {7-11}
@@ -54,7 +57,7 @@ const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h'
const echoCities = async () => {
try{
let cities = await supabase
- .rpc('echo_cities', [
+ .rpc('echo_city', [
{ name: 'The Shire' },
{ name: 'Mordor' }
])
@@ -124,7 +127,7 @@ Parameters to be passed to the stored function.
---
## Filtering
-If the response of the stored procedure is that of a table type response, the following filters can be utilised to further sift out the data.
+If the stored procedure returns a table, you can also apply filters to the response.
### `filter()`
<CommonFilters filter='filter'/>
diff --git a/web/src/pages/index.js b/web/src/pages/index.js
index c7a7d0cbd8a..7a1acd00d9a 100755
--- a/web/src/pages/index.js
+++ b/web/src/pages/index.js
@@ -125,7 +125,7 @@ function Home() {
<header className={classnames('hero', styles.heroBanner)}>
<div className="container">
<div className="row">
- <div className="col">
+ <div className="col col--5">
<h2 className="hero__title">{siteConfig.tagline}</h2>
<p className="hero__subtitle">
Supabase adds realtime and RESTful APIs to your{' '}
@@ -155,7 +155,7 @@ function Home() {
</Link>
</div>
</div>
- <div className="col code-with-header">
+ <div className="col col--7 code-with-header">
<div className="code-header">Get notified of all new records in your database</div>
<CodeBlock>{heroExample}</CodeBlock>
</div>