mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
Translate PostgreSQL CREATE TABLE AS and its legacy SELECT ... INTO spelling into Turso's CREATE TABLE ... AS SELECT so the pg frontend can create tables from query results. WITH NO DATA creates the table from the SELECT's shape without copying rows, IF NOT EXISTS is honored, and INTO in nested or compound positions is rejected rather than silently dropped. The server reports completion as `SELECT n` like PostgreSQL, except WITH NO DATA which keeps the plain CREATE TABLE AS tag. Explicit column lists on CTAS are rejected because the engine derives column names from the SELECT and cannot override them. Tests: postgres/conformance/pg-sqltests/table.sqltest covers CTAS and SELECT INTO behavior; postgres/cli/tests/tursopg.rs covers the wire command tags; postgres/tests/integration covers the rejection paths where Turso intentionally diverges from PostgreSQL. Co-authored-by: theFestest <theFestest@users.noreply.github.com>