Skip to content

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

Improves guides

Paul Copplestonedb27a698754a
diff --git a/web/docs/guides.md b/web/docs/guides.md
index c06ca9b19db..dbcbc80404c 100644
--- a/web/docs/guides.md
+++ b/web/docs/guides.md
@@ -7,9 +7,16 @@ hide_title: true
## Guides
-<!-- @TODO: improve -->
-Supabase is a suite of integrated tools. These guides will help you build your product using the Supabase stack.
+### Database
+These guides help you unleash the power of PostgreSQL, the world's most advanced open source database.
+
+### Auth
+
+Authenticating users isn't the most exciting job for most developers, so Supabase makes it quick and simple, while maintaining security and performance.
+
+
+<!--
<a className="card" href="/docs/guides/database" style={{marginBottom: 10}}>
<div className="card__body">
<h3>Database</h3>
@@ -22,4 +29,4 @@ Supabase is a suite of integrated tools. These guides will help you build your p
<h3>Auth</h3>
<p>Authenticating users isn't the most exciting job for most developers, so Supabase makes it quick and simple, while maintaining security and performance.</p>
</div>
-</a>
+</a> -->
diff --git a/web/docs/guides/database/extensions/pgtap.mdx b/web/docs/guides/database/extensions/pgtap.mdx
index 22329e67001..5a2e76fc8ce 100644
--- a/web/docs/guides/database/extensions/pgtap.mdx
+++ b/web/docs/guides/database/extensions/pgtap.mdx
@@ -39,13 +39,10 @@ values={[
4. Click the toggle.
```
-
<video width="99%" muted playsInline controls={true}>
<source src="/videos/toggle-extensions.mp4" type="video/mp4" muted playsInline />
</video>
-
-
</TabItem>
<TabItem value="SQL">
@@ -68,6 +65,13 @@ It's good practise to create the extension within a separate schema (like `exten
</Tabs>
+### Managing tests
+
+It's a good practice to keep all your tests in a separate schema.
+
+```sql
+create schema tests;
+```
### Creating a test
diff --git a/web/docs/guides/database/extensions/plv8.mdx b/web/docs/guides/database/extensions/plv8.mdx
index 0a2f2a10a32..9b3bb7ed371 100644
--- a/web/docs/guides/database/extensions/plv8.mdx
+++ b/web/docs/guides/database/extensions/plv8.mdx
@@ -46,7 +46,7 @@ values={[
```sql
-- Example: enable the "plv8" extension
-create extension plv8 with schema extensions;
+create extension plv8;
-- Example: disable the "plv8" extension
drop extension if exists plv8;
@@ -56,7 +56,7 @@ drop extension if exists plv8;
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
To disable an extension you can call `drop extension`.
-It's good practise to create the extension within a separate schema (like `extensions`) to keep your database clean.
+Procedural languages are automatically installed within `pg_catalog`, so you don't need to specify a schema.
</TabItem>
@@ -99,28 +99,38 @@ returns text as $$
$$ language plv8;
```
-### Set-returning Functions
+### Executing SQL
-A [set-returning function](https://plv8.github.io/#set-returning-function-calls) is anything that returns a full set of results - for example, rows in a table.
+You can execute SQL within `plv8` code using the [`plv8.execute` function](https://plv8.github.io/#plv8-execute).
```sql
-create or replace function get_rows()
-returns text as $$
+create or replace function update_user(id bigint, first_name text)
+returns smallint as $$
- -- @TODO
+ var num_affected = plv8.execute(
+ 'udpate profiles set first_name = $1 where id = $2',
+ [id, first_name]
+ );
+ return num_affected;
$$ language plv8;
```
+### Set-returning Functions
-## Configuration
+A [set-returning function](https://plv8.github.io/#set-returning-function-calls) is anything that returns a full set of results - for example, rows in a table.
-@TODO: break this down:
+```sql
+create or replace function get_messages()
+returns setof messages as $$
+ var json_result = plv8.execute(
+ 'select * from messages'
+ );
-> It has its own runtime environment that can be customized with a runtime startup procedure (`set plv8.start_proc`)
-and execution timeout period (`set plv8.execution_timeout`). It can execute multiple types of function calls inside of PostgreSQL
-including `Scalar Function Calls`, `Set-returning Function Calls`, `Trigger Function Calls`, and more.
+ return json_result;
+$$ language plv8;
+```
## Resources
diff --git a/web/docusaurus.config.js b/web/docusaurus.config.js
index 35bcfafd337..685d4716b7d 100755
--- a/web/docusaurus.config.js
+++ b/web/docusaurus.config.js
@@ -70,13 +70,13 @@ module.exports = {
{
label: 'Overview',
to: '/docs',
- activeBaseRegex: '(^/docs$)|(/docs/faq)',
+ activeBaseRegex: '(^/docs$)|(/docs/faq)|(^/docs/guides/examples)',
position: 'left',
},
{
label: 'Guides',
to: '/docs/guides',
- activeBaseRegex: '(/docs/guides)',
+ activeBaseRegex: '(^/docs/guides/database/|^/docs/guides/auth/)',
position: 'left',
},
{