Skip to content

test: PostgreSQL driver conformance + benchmark vs pgx #131

@FumingPower3925

Description

@FumingPower3925

Summary

Comprehensive conformance tests and performance benchmarks for the celeris PostgreSQL driver. Tests validate correctness against a real PostgreSQL instance. Benchmarks compare against pgx (the fastest pure-Go PG driver).

Conformance Tests

Connection & Auth

  • MD5 authentication
  • SCRAM-SHA-256 authentication
  • Trust authentication
  • Connection with all DSN formats (URL and key=value)
  • SSL/TLS connection (if supported)

Query Execution

  • Simple query: SELECT, INSERT, UPDATE, DELETE
  • Extended query: prepared statements with parameters
  • Multiple result sets from single query
  • NULL handling (NULL params, NULL results)
  • All supported types: int, float, bool, text, bytea, timestamp, date, uuid, jsonb, arrays
  • Large result sets (100K+ rows)
  • Empty result sets

Transactions

  • BEGIN/COMMIT/ROLLBACK
  • Isolation levels: ReadCommitted, RepeatableRead, Serializable
  • Savepoints (if supported)
  • Transaction rollback on error

COPY

  • COPY IN with text format
  • COPY IN with binary format
  • COPY OUT
  • COPY with large datasets (1M+ rows)
  • COPY abort (CopyFail)

Error Handling

  • SQL syntax errors
  • Constraint violations (unique, foreign key, check)
  • Connection loss during query
  • Context cancellation during query
  • Context cancellation during COPY

Pool

  • Worker affinity routing
  • Overflow to shared pool
  • MaxOpen enforcement
  • Connection health checks
  • Idle connection cleanup

Benchmarks

vs pgx Comparison

BenchmarkSimpleQuery/celeris
BenchmarkSimpleQuery/pgx
BenchmarkPreparedQuery/celeris
BenchmarkPreparedQuery/pgx
BenchmarkBulkInsert/celeris
BenchmarkBulkInsert/pgx
BenchmarkCopyIn/celeris
BenchmarkCopyIn/pgx
BenchmarkPoolGetRelease/celeris
BenchmarkPoolGetRelease/pgx
BenchmarkConcurrentQueries/celeris
BenchmarkConcurrentQueries/pgx

Metrics

  • Queries per second
  • Latency (p50, p99)
  • Memory allocations per query
  • Connection establishment time

Acceptance Criteria

  • All conformance tests pass against PostgreSQL 15+
  • Tests run in CI with PostgreSQL container
  • Benchmark suite comparing against pgx
  • Zero-alloc on common query hot path (verified by benchmarks)
  • Pool tests validate worker affinity behavior
  • COPY benchmarks with 1M+ rows

Dependencies

  • Depends on 129 (database/sql Driver implementation)
  • Depends on 130 (connection pool)

Metadata

Metadata

Labels

area/driverDatabase/cache driver infrastructurearea/testTesting infrastructuredriver/postgresPostgreSQL driver

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions