The postgres adapter provides storage.Conn and ddl.Compiler implementations for PostgreSQL.
OpCopyColumn→UPDATE … SET dest = src WHERE dest IS NULL AND src IS NOT NULLIt now also supports opening a pg_dump archive as a read-onlyddl.Snapshotviapostgres.Backups.
- PostgresAdapter: The core adapter implementing
storage.Connandddl.Compiler. - Backups: A factory for opening pg_dump archives (
ddl.BackupFormat). - snapshot: A restored archive answering
ddl.Snapshot. It wrapsPostgresAdapterto reuse schema introspection (Tables, Columns) and cast all column values to text during ReadTable.
- OpenBackup: When opening a backup, the adapter creates a temporary database (
snapshot_<nano>), restores the archive into it usingpg_restore(with--no-owner --no-acl), connects to the restored database, and returns a snapshot. - Close: The snapshot closes the connection and forcefully drops the temporary database.
- restore then read with SQL; never parse the custom format: To read a
pg_dump -Fcarchive, we leveragepg_restoreto dump it into a temporary database rather than trying to parse the complex binary custom format directly. This is the documented and reliable way to read custom format archives.