Documentation
¶
Overview ¶
Package source.postgres implements the PostgreSQL replication source: a single logical-decoding reader (pgoutput) that decodes row changes into rowchange.Change, positions them at their commit LSN, and exposes the synced and confirmed positions for the DBLog watermark logic. The snapshot path reuses the source-agnostic DBLog orchestrator.
Package catalog reads a table's shape from the PostgreSQL catalogs (its columns, types and primary key), maps it to the canonical schema, and quotes identifiers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalSchema ¶
func CanonicalSchema(tbl *TableState) (core.Schema, error)
CanonicalSchema derives the canonical core.Schema from the introspected table. Mappable columns map to their canonical kind; unmappable ones are carried as KindUnknown so a declared cast can land them explicitly — never silent coercion. The source knows nothing about any sink.
func QuoteIdent ¶
QuoteIdent quotes one identifier, doubling embedded quotes.
Types ¶
type Column ¶
type Column struct {
Name string
// DataType is the SQL-standard BASE type WITHOUT a modifier
// ("character varying", "numeric", "timestamp with time zone") — the form
// every switch compares against and every `?::<type>` cast accepts.
DataType string
// RawType is format_type with the modifier ("character varying(64)",
// "numeric(10,2)"), kept only so decimal precision/scale can be parsed
// (issue #561).
RawType string
NotNull bool // attnotnull: the column cannot hold NULL
}
Column is one introspected source column.
type TableState ¶
TableState is the introspection result for one source table: the ordered column list and the primary key column indexes, so row decoding and Iceberg schema derivation share one path.
func QueryTable ¶
QueryTable introspects one table via pg_catalog, producing the column order the pgoutput relation messages follow.
func (*TableState) FindColumn ¶
func (t *TableState) FindColumn(name string) int
FindColumn returns the column index by name, or -1.