pgvector-pascal
Pascal bindings and examples for pgvector, supporting PostgreSQL-powered vector search from Pascal applications.
About this tool
title: pgvector-pascal slug: pgvector-pascal brand: pgvector category: sdks-libraries tags:
- sdk
- pgvector
- vector-store source_url: https://github.com/pgvector/pgvector-pascal images:
- https://opengraph.githubassets.com/1/pgvector/pgvector-pascal
Overview
pgvector-pascal provides Pascal examples and bindings for using the pgvector PostgreSQL extension, enabling vector similarity search from Pascal applications. It currently supports the SQLDB database library from Free Pascal.
Features
-
Pascal bindings for pgvector
- Demonstrates how to use PostgreSQL’s
vectortype from Pascal code - Integrates with the pgvector extension for vector similarity search
- Demonstrates how to use PostgreSQL’s
-
SQLDB support
- Works with Free Pascal’s SQLDB library
- Uses
TSQLQuery(or equivalent) to execute SQL with vector types and parameters
-
Extension setup
- Example code to enable the pgvector extension:
CREATE EXTENSION IF NOT EXISTS vector - Shows how to run this via
Query.SQL.TextandQuery.ExecSQL
- Example code to enable the pgvector extension:
-
Schema definition with vector columns
- Example table creation with a vector column:
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3))
- Example table creation with a vector column:
-
Inserting vectors from Pascal
- Parameterized insert statements using Pascal string parameters cast to
vectortype - Demonstrates inserting multiple vector rows in one statement:
INSERT INTO items (embedding) VALUES ((:embedding1)::vector), ((:embedding2)::vector)
- Parameterized insert statements using Pascal string parameters cast to
-
Nearest neighbor search
- Example query ordering by vector distance:
SELECT * FROM items ORDER BY embedding <-> (:embedding)::vector LIMIT 5 - Shows how to bind query parameters and iterate over result rows in Pascal
- Example query ordering by vector distance:
-
Approximate vector indexing
- Examples of creating HNSW index:
CREATE INDEX ON items USING hnsw (embedding vector_l2_ops) - Examples of creating IVFFlat index with configuration:
CREATE INDEX ON items USING ivfflat (embedding vector_l2_ops) WITH (lists = 100)
- Examples of creating HNSW index:
-
Multiple distance metrics
- Notes on choosing operator classes for different similarity metrics:
vector_l2_opsfor Euclidean (L2) distancevector_ip_opsfor inner productvector_cosine_opsfor cosine distance
- Notes on choosing operator classes for different similarity metrics:
-
Runnable example program
- Repository includes a complete example (
example.pp) showing end-to-end usage:
extension creation, table creation, inserts, search, and iteration over results
- Repository includes a complete example (
-
Development and testing setup
- Example commands to clone and run:
git clone https://github.com/pgvector/pgvector-pascal.gitcd pgvector-pascalcreatedb pgvector_pascal_testfpc example.ppand./example
- Instructions for specifying the path to
libpqby symlinkinglibpq.dylibwhen needed
- Example commands to clone and run:
Usage
- Install and enable pgvector in PostgreSQL.
- Use SQLDB in a Free Pascal application to:
- Enable the extension (
CREATE EXTENSION IF NOT EXISTS vector). - Create tables with
vector(n)columns. - Insert vectors as strings cast to
vectortype via parameters. - Run similarity queries with
<->and limit results. - Add HNSW or IVFFlat indexes for approximate nearest neighbor search.
- Enable the extension (
Pricing
- Not specified in the provided content (GitHub-hosted example/binding, typically open source).
Loading more......
Information
Categories
Tags
Similar Products
6 result(s)COBOL bindings and examples for pgvector, letting legacy COBOL systems interact with PostgreSQL as a vector database.
Crystal language client for pgvector, providing idiomatic Crystal access to vector operations in PostgreSQL.
.NET (C#, F#, Visual Basic) library for pgvector that exposes vector storage and similarity queries on PostgreSQL to .NET applications.
Elixir wrapper and examples for pgvector, integrating PostgreSQL-based vector search into Elixir ecosystems like Phoenix.
Erlang client and examples for pgvector, providing tools to run vector operations against PostgreSQL from Erlang systems.
Gleam language client and examples for pgvector, allowing Gleam applications to perform vector similarity search using PostgreSQL.