Part 2 of 22 in the pg_dump feature series, stacked on https://github.com/tursodatabase/turso/pull/9716 (`postgres-pgdump- catalog-tableoid`). Review this diff against its immediate parent. Declare existing catalog boolean fields as BOOLEAN instead of INTEGER, so PostgreSQL clients receive the expected column types. Stored row values remain unchanged. tableoid comes from the preceding layer. This is one of ten smaller layers extracted from the former combined PR #9701. Catalog system columns and boolean types now come before session setup. The combined source and existing regression tests are unchanged; early layers do not claim complete pg_dump support. Reorganized with Amp under Pedro's direction, preserving the published combined source and running before/after regressions plus cumulative checks at every new layer. Closes #9717
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.