Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.

Commit c93d8ce

Browse files
authored
chore: pgai db on pg18 (#901)
1 parent f92ffe4 commit c93d8ce

6 files changed

Lines changed: 83 additions & 2 deletions

File tree

projects/pgai/db/justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export PROJECT_JUSTFILE := "1" # Note: used in build.py
2-
PG_MAJOR := env("PG_MAJOR", "17")
2+
PG_MAJOR := env("PG_MAJOR", "18")
33
PG_BIN := env("PG_BIN", "/usr/lib/postgresql/" + PG_MAJOR + "/bin")
44
OVERWRITE_GOLDEN := env("OVERWRITE_GOLDEN", "false")
55

@@ -75,4 +75,4 @@ docker-shell:
7575

7676
# Launches a psql shell in the container
7777
psql-shell:
78-
@docker exec -it -u postgres pgai-db /bin/bash -c "set -e; if [ -f .env ]; then set -a; source .env; set +a; fi; psql"
78+
@docker exec -it -u postgres pgai-db /bin/bash -c "set -e; if [ -f .env ]; then set -a; source .env; set +a; fi; psql"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Table "ai._vectorizer_q_1"
2+
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
3+
---------------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
4+
title | text | | not null | | extended | | |
5+
published | timestamp with time zone | | not null | | plain | | |
6+
queued_at | timestamp with time zone | | not null | now() | plain | | |
7+
loading_retries | integer | | not null | 0 | plain | | |
8+
loading_retry_after | timestamp with time zone | | | | plain | | |
9+
Indexes:
10+
"_vectorizer_q_1_title_published_idx" btree (title, published)
11+
Not-null constraints:
12+
"_vectorizer_q_1_title_not_null" NOT NULL "title"
13+
"_vectorizer_q_1_published_not_null" NOT NULL "published"
14+
"_vectorizer_q_1_queued_at_not_null" NOT NULL "queued_at"
15+
"_vectorizer_q_1_loading_retries_not_null" NOT NULL "loading_retries"
16+
Access method: heap
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Table "website.blog"
2+
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
3+
-----------+--------------------------+-----------+----------+------------------------------+----------+-------------+--------------+-------------
4+
id | integer | | not null | generated always as identity | plain | | |
5+
title | text | | not null | | extended | | |
6+
published | timestamp with time zone | | not null | | plain | | |
7+
body | text | | not null | | extended | | |
8+
Indexes:
9+
"blog_pkey" PRIMARY KEY, btree (title, published)
10+
Not-null constraints:
11+
"blog_id_not_null" NOT NULL "id"
12+
"blog_title_not_null" NOT NULL "title"
13+
"blog_published_not_null" NOT NULL "published"
14+
"blog_body_not_null" NOT NULL "body"
15+
Triggers:
16+
_vectorizer_src_trg_1 AFTER INSERT OR DELETE OR UPDATE ON website.blog FOR EACH ROW EXECUTE FUNCTION ai._vectorizer_src_trg_1()
17+
_vectorizer_src_trg_1_truncate AFTER TRUNCATE ON website.blog FOR EACH STATEMENT EXECUTE FUNCTION ai._vectorizer_src_trg_1()
18+
Access method: heap
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
List of functions
2+
Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Leakproof? | Access privileges | Language | Internal name | Description
3+
--------+-----------------------+------------------+---------------------+------+------------+----------+-------+----------+------------+-------------------+----------+---------------+-------------
4+
ai | _vectorizer_src_trg_1 | trigger | | func | volatile | safe | test | definer | no | test=X/test | plpgsql | |
5+
(1 row)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Table "website.blog_embedding_store"
2+
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
3+
----------------+--------------------------+-----------+----------+-------------------+----------+-------------+--------------+-------------
4+
embedding_uuid | uuid | | not null | gen_random_uuid() | plain | | |
5+
title | text | | not null | | extended | | |
6+
published | timestamp with time zone | | not null | | plain | | |
7+
chunk_seq | integer | | not null | | plain | | |
8+
chunk | text | | not null | | extended | | |
9+
embedding | vector(768) | | not null | | main | | |
10+
Indexes:
11+
"blog_embedding_store_pkey" PRIMARY KEY, btree (embedding_uuid)
12+
"blog_embedding_store_title_published_chunk_seq_key" UNIQUE CONSTRAINT, btree (title, published, chunk_seq)
13+
Not-null constraints:
14+
"blog_embedding_store_embedding_uuid_not_null" NOT NULL "embedding_uuid"
15+
"blog_embedding_store_title_not_null" NOT NULL "title"
16+
"blog_embedding_store_published_not_null" NOT NULL "published"
17+
"blog_embedding_store_chunk_seq_not_null" NOT NULL "chunk_seq"
18+
"blog_embedding_store_chunk_not_null" NOT NULL "chunk"
19+
"blog_embedding_store_embedding_not_null" NOT NULL "embedding"
20+
Access method: heap
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
View "website.blog_embedding"
2+
Column | Type | Collation | Nullable | Default | Storage | Description
3+
----------------+--------------------------+-----------+----------+---------+----------+-------------
4+
embedding_uuid | uuid | | | | plain |
5+
chunk_seq | integer | | | | plain |
6+
chunk | text | | | | extended |
7+
embedding | vector(768) | | | | external |
8+
id | integer | | | | plain |
9+
title | text | | | | extended |
10+
published | timestamp with time zone | | | | plain |
11+
body | text | | | | extended |
12+
View definition:
13+
SELECT t.embedding_uuid,
14+
t.chunk_seq,
15+
t.chunk,
16+
t.embedding,
17+
s.id,
18+
t.title,
19+
t.published,
20+
s.body
21+
FROM website.blog_embedding_store t
22+
LEFT JOIN website.blog s ON t.title = s.title AND t.published = s.published;

0 commit comments

Comments
 (0)