Files
turso/postgres/cli
Pekka Enberg 4de24b0c62 core: Pass connection settings to Database::connect as ConnectOpts
Database had five public ways to open a connection: connect,
connect_with_encryption, connect_with_page_codec, connect_async and
connect_with_encryption_async. Every new connection setting needs more
variants, and the async path doubles them again.

Database::connect and Database::connect_async now take a ConnectOpts
that holds the encryption key and the page codec, and the other three
variants are removed. ConnectOpts has no Default, so every caller goes
through ConnectOpts::new() and a required argument added there later
makes the compiler find every call site.
2026-10-12 10:05:12 +03:00
..
…
2026-08-11 05:07:30 -05:00
2026-08-12 21:48:54 -07:00

tursopg

In-process PostgreSQL reimplementation backed by Turso's SQLite-compatible engine.

tursopg translates PostgreSQL SQL (via libpg_query) directly into Turso's AST, then executes it through the full Turso compilation and bytecode pipeline. No SQLite text is ever generated — the entire path from PG parse tree to bytecode is native.

Live Materialized Views

Unlike PostgreSQL, where materialized views are static snapshots that require REFRESH MATERIALIZED VIEW to update, tursopg's materialized views are live. They automatically reflect changes to the underlying tables without any manual refresh step.

This is possible because Turso implements materialized views using DBSP (Differential DataFlow Stream Processing) for incremental maintenance. When you insert, update, or delete rows in a base table, the materialized view is updated incrementally — no full recomputation needed.

CREATE TABLE sales(product TEXT, amount INT);
INSERT INTO sales VALUES ('Widget', 100);

CREATE MATERIALIZED VIEW totals AS
  SELECT product, SUM(amount) as total FROM sales GROUP BY product;

SELECT * FROM totals;
-- Widget | 100

INSERT INTO sales VALUES ('Widget', 50);

-- No REFRESH needed — the view is already up to date
SELECT * FROM totals;
-- Widget | 150

REFRESH MATERIALIZED VIEW is accepted for compatibility but is a no-op. DROP MATERIALIZED VIEW works as expected.