Skip to content

Commit 5cfc390

Browse files
authored
docs: Add schema qualified object references throughout the docs (supabase#39904)
* Update vector type * Update http and postgis * Missed a spot on Postgis * convert the gis reference to extensions in postgis guide
1 parent 6245ba5 commit 5cfc390

File tree

15 files changed

+40
-49
lines changed

15 files changed

+40
-49
lines changed

apps/docs/content/guides/ai/engineering-for-scale.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ We can now create a foreign table to access the data in our secondary project.
110110
```sql
111111
create foreign table docs (
112112
id text not null,
113-
embedding vector(384),
113+
embedding extensions.vector(384),
114114
metadata jsonb,
115115
url text
116116
)

apps/docs/content/guides/ai/examples/mixpeek-video-search.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def seed():
8484
"id": "text",
8585
"start_time": "float8",
8686
"end_time": "float8",
87-
"embedding": "vector(768)",
87+
"embedding": "extensions.vector(768)",
8888
"metadata": "jsonb"
8989
})
9090

apps/docs/content/guides/ai/examples/nextjs-vector-search.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Let's prepare the database schema. We can use the "OpenAI Vector Search" quickst
130130
page_id bigint not null references public.nods_page on delete cascade,
131131
content text,
132132
token_count int,
133-
embedding vector(1536),
133+
embedding extensions.vector(1536),
134134
slug text,
135135
heading text
136136
);
@@ -156,7 +156,7 @@ Let's prepare the database schema. We can use the "OpenAI Vector Search" quickst
156156
```sql
157157
-- Create embedding similarity search functions
158158
create or replace function match_page_sections(
159-
embedding vector(1536),
159+
embedding extensions.vector(1536),
160160
match_threshold float,
161161
match_count int,
162162
min_content_length int

apps/docs/content/guides/ai/hybrid-search.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ create table documents (
5353
id bigint primary key generated always as identity,
5454
content text,
5555
fts tsvector generated always as (to_tsvector('english', content)) stored,
56-
embedding vector(512)
56+
embedding extensions.vector(512)
5757
);
5858
```
5959

@@ -83,7 +83,7 @@ Finally we'll create our `hybrid_search` function:
8383
```sql
8484
create or replace function hybrid_search(
8585
query_text text,
86-
query_embedding vector(512),
86+
query_embedding extensions.vector(512),
8787
match_count int,
8888
full_text_weight float = 1,
8989
semantic_weight float = 1,
@@ -158,7 +158,7 @@ select
158158
from
159159
hybrid_search(
160160
'Italian recipes with tomato sauce', -- user query
161-
'[...]'::vector(512), -- embedding generated from user query
161+
'[...]'::extensions.vector(512), -- embedding generated from user query
162162
10
163163
);
164164
```

apps/docs/content/guides/ai/langchain.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ create table documents (
3636
id bigserial primary key,
3737
content text, -- corresponds to Document.pageContent
3838
metadata jsonb, -- corresponds to Document.metadata
39-
embedding vector(1536) -- 1536 works for OpenAI embeddings, change if needed
39+
embedding extensions.vector(1536) -- 1536 works for OpenAI embeddings, change if needed
4040
);
4141

4242
-- Create a function to search for documents
4343
create function match_documents (
44-
query_embedding vector(1536),
44+
query_embedding extensions.vector(1536),
4545
match_count int default null,
4646
filter jsonb DEFAULT '{}'
4747
) returns table (

apps/docs/content/guides/ai/rag-with-permissions.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ create table document_sections (
2929
id bigint primary key generated always as identity,
3030
document_id bigint not null references documents (id),
3131
content text not null,
32-
embedding vector (384)
32+
embedding extensions.vector (384)
3333
);
3434
```
3535

@@ -176,7 +176,7 @@ create table document_sections (
176176
id bigint primary key generated always as identity,
177177
document_id bigint not null,
178178
content text not null,
179-
embedding vector (384)
179+
embedding extensions.vector (384)
180180
);
181181
```
182182

apps/docs/content/guides/ai/semantic-search.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ To implement semantic search in Postgres we use `pgvector` - an extension that a
4848
create table documents (
4949
id bigint primary key generated always as identity,
5050
content text,
51-
embedding vector(512)
51+
embedding extensions.vector(512)
5252
);
5353
```
5454

5555
Or if you have an existing table, you can add a vector column like so:
5656

5757
```sql
5858
alter table documents
59-
add column embedding vector(512);
59+
add column embedding extensions.vector(512);
6060
```
6161

6262
In this example, we create a column named `embedding` which uses the newly enabled `vector` data type. The size of the vector (as indicated in parentheses) represents the number of dimensions in the embedding. Here we use 512, but adjust this to match the number of dimensions produced by your embedding model.
@@ -80,7 +80,7 @@ The easiest way to perform semantic search in Postgres is by creating a function
8080
```sql
8181
-- Match documents using cosine distance (<=>)
8282
create or replace function match_documents (
83-
query_embedding vector(512),
83+
query_embedding extensions.vector(512),
8484
match_threshold float,
8585
match_count int
8686
)
@@ -108,7 +108,7 @@ You'll notice we are using the cosine distance (`<=>`) operator in our query. Co
108108
```sql
109109
-- Match documents using negative inner product (<#>)
110110
create or replace function match_documents (
111-
query_embedding vector(512),
111+
query_embedding extensions.vector(512),
112112
match_threshold float,
113113
match_count int
114114
)
@@ -142,7 +142,7 @@ You can also call this method directly from SQL:
142142
```sql
143143
select *
144144
from match_documents(
145-
'[...]'::vector(512), -- pass the query embedding
145+
'[...]'::extensions.vector(512), -- pass the query embedding
146146
0.78, -- chose an appropriate threshold for your data
147147
10 -- choose the number of matches
148148
);

apps/docs/content/guides/ai/structured-unstructured.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Most vector stores treat metadata associated with embeddings like NoSQL, unstruc
1313
```sql
1414
create table docs (
1515
id uuid primary key,
16-
embedding vector(3),
16+
embedding extensions.vector(3),
1717
content text,
1818
url text
1919
);
@@ -31,7 +31,7 @@ Notice that we've associated two pieces of metadata, `content` and `url`, with t
3131
```sql
3232
create table docs (
3333
id uuid primary key,
34-
embedding vector(3),
34+
embedding extensions.vector(3),
3535
meta jsonb
3636
);
3737

@@ -84,7 +84,7 @@ The structured metadata style is recommended when the fields being tracked are k
8484
```sql
8585
create table docs (
8686
id uuid primary key,
87-
embedding vector(3),
87+
embedding extensions.vector(3),
8888
content text,
8989
url string,
9090
meta jsonb

apps/docs/content/guides/ai/vector-columns.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ create table documents (
5555
id serial primary key,
5656
title text not null,
5757
body text not null,
58-
embedding vector(384)
58+
embedding extensions.vector(384)
5959
);
6060
```
6161

@@ -113,7 +113,7 @@ Supabase client libraries like `supabase-js` connect to your Postgres instance v
113113

114114
```sql
115115
create or replace function match_documents (
116-
query_embedding vector(384),
116+
query_embedding extensions.vector(384),
117117
match_threshold float,
118118
match_count int
119119
)

apps/docs/content/guides/database/extensions/http.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ A successful call to a web URL from the `http` extension returns a record with t
9494
select
9595
"status", "content"::jsonb
9696
from
97-
http_get('https://jsonplaceholder.typicode.com/todos/1');
97+
extensions.http_get('https://jsonplaceholder.typicode.com/todos/1');
9898
```
9999

100100
### Simple `POST` example
@@ -103,7 +103,7 @@ from
103103
select
104104
"status", "content"::jsonb
105105
from
106-
http_post(
106+
extensions.http_post(
107107
'https://jsonplaceholder.typicode.com/posts',
108108
'{ "title": "foo", "body": "bar", "userId": 1 }',
109109
'application/json'

0 commit comments

Comments
 (0)