Files
turso/postgres/cli
Amp 33aeddbd23 postgres: implement set_config with connection-local state
pg_dump sets search_path to an empty string before reading catalogs. Store
search_path in the injected connection state so native set_config calls
and SET statements update the same session setting during execution.
Keep an explicitly empty path distinct from the default and preserve
access to qualified public tables and implicit PostgreSQL catalogs.

Support session-scoped search_path only. Reject transaction-local settings
and unsupported parameters; transaction rollback restoration and separate
wire-client sessions are not implemented in this change.

Tests: eight new WAL/MVCC regression cases fail before and pass afterward;
424 PostgreSQL integration, 22 frontend, 181 parser, and four wire-protocol
search-path tests pass. CLI build and formatting checks pass.

Amp-Thread-ID: https://ampcode.com/threads/T-01a11786-6662-751d-925e-4ec4fecf16b3
Co-authored-by: pedro muniz <pedro.muniz.carlo@gmail.com>
2026-10-12 22:51:23 +00:00
..
2026-07-16 12:40:03 +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.