sqlite_fdw
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
sqlite_fdw | 2.5.0 | FDW | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 8640 | sqlite_fdw | No | Yes | No | Yes | No | Yes | - |
| Related | duckdb_fdw pglite_fusion omni_sqlite mysql_fdw oracle_fdw tds_fdw db2_fdw informix_fdw postgres_fdw firebird_fdw |
|---|
break on el8 due to sqlite-lib version low
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 2.5.0 | 1817161514 | sqlite_fdw | - |
| RPM | PGDG | 2.5.0 | 1817161514 | sqlite_fdw_$v | - |
| DEB | PIGSTY | 2.5.0 | 1817161514 | postgresql-$v-sqlite-fdw | - |
Build
You can build the RPM / DEB packages for sqlite_fdw using pig build:
Install
You can install sqlite_fdw directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Create Server
Server Options: database (required, path to SQLite file), updatable (default true), truncatable (default false), keep_connections (default true), batch_size (default 1), force_readonly (default false).
No CREATE USER MAPPING is required since SQLite has no authentication model.
Create Foreign Table
Table Options: table (SQLite table name if different from PostgreSQL name), updatable, truncatable, batch_size.
Column Options: column_name (map to different SQLite column name), column_type (SQLite affinity: INT for epoch timestamps, BLOB for UUIDs), key (mark as primary key for UPDATE/DELETE).
CRUD Operations
Import Foreign Schema
Import Options: import_default (default false), import_not_null (default true).
Data Type Mapping
| SQLite Type | PostgreSQL Type |
|---|---|
| int | bigint |
| text, char, clob | text |
| blob | bytea |
| real, float, double | double precision |
| datetime | timestamp |
| uuid | uuid |
| json, jsonb | json, jsonb |
Timestamps can be stored as TEXT (ISO format) or INT (Unix epoch, use column_type 'INT'). UUIDs can be stored as TEXT (36 chars) or BLOB (16 bytes). The SQLite database file must be readable (and writable for DML) by the PostgreSQL OS user.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)