Skip to content

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

docs(ref/js): add missing examples

Bobbie Soedirgo8079ebabc5c9
diff --git a/spec/supabase_js_v2.yml b/spec/supabase_js_v2.yml
index 1e832c9491a..e8a14cce030 100644
--- a/spec/supabase_js_v2.yml
+++ b/spec/supabase_js_v2.yml
@@ -972,6 +972,40 @@ functions:
.from('countries')
.select()
```
+ data:
+ sql: |
+ ```sql
+ create table
+ countries (id int8 primary key, name text);
+
+ insert into
+ countries (id, name)
+ values
+ (1, 'Afghanistan'),
+ (2, 'Albania'),
+ (3, 'Algeria');
+ ```
+ response: |
+ ```json
+ {
+ "data": [
+ {
+ "id": 1,
+ "name": "Afghanistan"
+ },
+ {
+ "id": 2,
+ "name": "Albania"
+ },
+ {
+ "id": 3,
+ "name": "Algeria"
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
- id: selecting-specific-columns
name: Selecting specific columns
code: |
@@ -980,6 +1014,37 @@ functions:
.from('countries')
.select('name')
```
+ data:
+ sql: |
+ ```sql
+ create table
+ countries (id int8 primary key, name text);
+
+ insert into
+ countries (id, name)
+ values
+ (1, 'Afghanistan'),
+ (2, 'Albania'),
+ (3, 'Algeria');
+ ```
+ response: |
+ ```json
+ {
+ "data": [
+ {
+ "name": "Afghanistan"
+ },
+ {
+ "name": "Albania"
+ },
+ {
+ "name": "Algeria"
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
- id: query-foreign-tables
name: Query foreign tables
description: |
@@ -995,6 +1060,54 @@ functions:
)
`)
```
+ data:
+ sql: |
+ ```sql
+ create table
+ countries (id int8 primary key, name text);
+ create table
+ cities (
+ id int8 primary key,
+ country_id int8 not null references countries,
+ name text
+ );
+
+ insert into
+ countries (id, name)
+ values
+ (1, 'Germany'),
+ (2, 'Indonesia');
+ insert into
+ cities (id, country_id, name)
+ values
+ (1, 2, 'Bali'),
+ (2, 1, 'Munich');
+ ```
+ response: |
+ ```json
+ {
+ "data": [
+ {
+ "name": "Germany",
+ "cities": [
+ {
+ "name": "Munich"
+ }
+ ]
+ },
+ {
+ "name": "Indonesia",
+ "cities": [
+ {
+ "name": "Bali"
+ }
+ ]
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
- id: query-foreign-tables-through-a-join-table
name: Query foreign tables through a join table
code: |