Implementing a Custom Vector Type for PostgreSQL with pgrx
Defining the Vector Structure
Our goal is to enable SQL statements like:
CREATE TABLE embeddings (embedding vector(3));
We start by defining a Rust struct that wraps a vector of floating-point numbers:
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct VectorData {
components: Vec<f64>,
}
</f6 ...
Posted on Tue, 25 Aug 2026 16:51:34 +0000 by mjohnson025