# Task 13 — Export: PostgreSQL ## Goal System-of-record load package: DDL + COPY-based bulk load (per ADR ingestion path). ## Input - `canonical/` snapshot, `schema/ddl_postgresql.sql`. ## Actions 1. Generate `exports/postgresql/`: - `01_schema.sql` (DDL, versioned); - `02_lookups.sql` (atmospheres, measurement_types, column_definitions, instruments); - per-table CSV staging files from canonical (streamed); - `03_copy_load.sql` (`\copy` statements in dependency order); - `04_post_load.sql` (indexes, constraints validation, ANALYZE); - `load.sh` / `load.ps1` orchestration. 2. Point tables loaded via COPY; headers via INSERT; partitioning DDL for `friction_data_points` per Phase-1 volume estimates. 3. Include `lineage` table load (row-range granularity). ## Intermediate Result (done when) - Package executes cleanly on an empty database (test locally if a PG instance is available; otherwise dry-validate SQL syntax). - Post-load counts script confirms parity with canonical. `EXPORT_MANIFEST.json` written.