



Pascal bindings and examples for pgvector, supporting PostgreSQL-powered vector search from Pascal applications.
Loading more......
title: pgvector-pascal slug: pgvector-pascal brand: pgvector category: sdks-libraries tags:
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.
Pascal bindings for pgvector
vector type from Pascal codeSQLDB support
TSQLQuery (or equivalent) to execute SQL with vector types and parametersExtension setup
CREATE EXTENSION IF NOT EXISTS vectorQuery.SQL.Text and Query.ExecSQLSchema definition with vector columns
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3))Inserting vectors from Pascal
vector typeINSERT INTO items (embedding) VALUES ((:embedding1)::vector), ((:embedding2)::vector)Nearest neighbor search
SELECT * FROM items ORDER BY embedding <-> (:embedding)::vector LIMIT 5Approximate vector indexing
CREATE INDEX ON items USING hnsw (embedding vector_l2_ops)CREATE INDEX ON items USING ivfflat (embedding vector_l2_ops) WITH (lists = 100)Multiple distance metrics
vector_l2_ops for Euclidean (L2) distancevector_ip_ops for inner productvector_cosine_ops for cosine distanceRunnable example program
example.pp) showing end-to-end usage:Development and testing setup
git clone https://github.com/pgvector/pgvector-pascal.gitcd pgvector-pascalcreatedb pgvector_pascal_testfpc example.pp and ./examplelibpq by symlinking libpq.dylib when neededCREATE EXTENSION IF NOT EXISTS vector).vector(n) columns.vector type via parameters.<-> and limit results.