lance
lance · PostgreSQL FDW extension for reading and querying Lance format tables
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100726 | lance | lance | 0.0.0 | FDW | Apache-2.0 | Rust |
PostgreSQL · 13, 14, 15, 16, 17
Usage
Sources:
- Official README at the reviewed revision
- Extension control file
- SQL-visible Rust entry points
- Arrow/Lance type mapping
lance is the PostgreSQL extension produced by the pglance Rust crate. Version 0.0.0 exposes local or remote Lance datasets as read-only foreign tables through lance_fdw, with helpers for schema discovery and namespace reconciliation.
Core Workflow
Create the extension and an FDW server, then import a dataset by URI:
lance_import inspects the Lance schema, creates the foreign table, and creates PostgreSQL composite types for nested struct fields when needed.
For a Lance namespace, inspect the plan before applying DDL:
Objects and Options
lance_fdwimplements foreign scans; the reviewed handler has no insert, update, or delete callbacks.lance_import(server_name, local_schema, table_name, uri, batch_size)creates one foreign table from a dataset URI.lance_attach_namespace(...)creates local schemas, foreign tables, and nested composite types for a namespace tree.lance_sync_namespace(...)reports or reconciles drift;drop_missingandrecreate_changedenable destructive DDL.urican be set on the server or foreign table.batch_sizedefaults to 1024, with a table option overriding the server option.- Namespace tables use
ns.table_idas a JSON array of strings; server options underns.*configure the namespace implementation.
Native mappings include Boolean to boolean, signed/unsigned integers to the nearest PostgreSQL integer type, strings to text, binary values to bytea, dates and timestamps to PostgreSQL temporal types, lists to arrays, structs to generated composite types, and maps or unsupported types to jsonb.
Operational Boundaries
The control file marks lance as an untrusted superuser-only extension. The reviewed crate advertises PostgreSQL 13–17 build features, but version 0.0.0 is an early interface and should be tested against the exact server and Lance files in use.
Foreign scans read files or remote object storage with the database server’s filesystem, network, and credential context. Restrict URIs and storage options accordingly. Always inspect dry_run output before namespace attachment or synchronization; enabling drop_missing or recreate_changed can drop or replace local foreign tables and their dependent objects.