Skip to main content
Version: Next

Compatibility layer overview (src/sydra/compat*)

This set of modules provides SydraDB’s PostgreSQL-compatibility “edges”:

  • A minimal SQLSTATE mapping and error payload format
  • A tiny, in-memory catalog snapshot builder (namespaces/relations/attributes/types)
  • A PostgreSQL wire-protocol (pgwire) listener that accepts clients like psql
  • Translation telemetry (counters + JSONL event recorder)
  • Test fixtures for SQL→sydraQL translation

Module map

See also

How pgwire executes a query (happy path)

  1. wire/protocol.readStartup parses the startup packet (and declines SSL).
  2. wire/session.performHandshake responds with:
    • AuthenticationOk
    • multiple ParameterStatus
    • ReadyForQuery
  3. wire/server.messageLoop reads frontend messages.
  4. For a Simple Query (Q) message, wire/server.handleSimpleQuery does:

Key limitations (current code)

  • SSL/TLS: not implemented (SSLRequest is declined).
  • Cancel requests: not supported.
  • Extended query protocol: not implemented (Parse message returns a 0A000 error).
  • Types: RowDescription uses a single “default” type mapping for all columns.

Code excerpt (root re-exports)

src/sydra/compat.zig
pub const stats = @import("compat/stats.zig");
pub const sqlstate = @import("compat/sqlstate.zig");
pub const clog = @import("compat/log.zig");
pub const fixtures = struct {
pub const translator = @import("compat/fixtures/translator.zig");
};
pub const catalog = @import("compat/catalog.zig");
pub const wire = @import("compat/wire.zig");