1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! PGVector vector store (PostgreSQL + pgvector extension)
//!
//! This module provides helper utilities for PGVector. The full `PGVectorStore`
//! implementation requires `sqlx` and `pgvector` crates, which must be added
//! by the user to their own `Cargo.toml` due to potential conflicts with
//! `rusqlite` (libsqlite3-sys linkage).
//!
//! To use `PGVectorStore`, add these to your `Cargo.toml`:
//! ```toml
//! sqlx = { version = "0.7", features = ["runtime-tokio", "postgres"] }
//! pgvector = { version = "0.3", features = ["sqlx"] }
//! ```
//!
//! Then enable the `pgvector-storage` feature and include the implementation
//! from the project's `src/vector_stores/pgvector.rs`.
use LazyLock;
use Regex;
static TABLE_NAME_RE: =
new;
/// Validate that a table name is safe for SQL interpolation.
///
/// Only allows: `^[a-zA-Z_][a-zA-Z0-9_]*$`
/// This prevents SQL injection via table names.
/// Build CREATE TABLE SQL (pure function, convenient for testing)