Skip to content

feat: add CockroachDB database support#182

Open
datlechin wants to merge 6 commits intomainfrom
feat/cockroachdb-support
Open

feat: add CockroachDB database support#182
datlechin wants to merge 6 commits intomainfrom
feat/cockroachdb-support

Conversation

@datlechin
Copy link
Owner

Summary

Closes #114

Adds CockroachDB database support to TablePro. CockroachDB is PostgreSQL wire-compatible, so this leverages the existing LibPQ connector with CockroachDB-specific extensions.

What's included

  • CockroachDBDriver — Full driver implementation using libpq (PostgreSQL wire protocol), with CockroachDB-specific queries for:
    • Real index browsing via pg_index/pg_class (unlike Redshift's DISTKEY/SORTKEY)
    • Approximate row counts via crdb_internal.table_row_statistics
    • Table size via crdb_internal.table_span_stats with pg_total_relation_size() fallback
    • System databases: system, defaultdb
    • Schema switching, DDL generation, view definitions
    • Auto-reconnect on connection loss
  • Icon asset — Placeholder SVG icon for CockroachDB connections
  • Default port: 26257
  • URL scheme: cockroachdb://
  • Schema editing support (ALTER TABLE — unlike Redshift)

Integration points (already in main)

All switch statement integrations were included in a prior commit. This PR adds the driver implementation and icon asset that were missing.

Test plan

  • Create a CockroachDB connection with host/port/credentials
  • Verify connection test succeeds
  • Browse tables, columns, indexes
  • Execute queries
  • Verify schema switching works
  • Test cockroachdb:// URL import
  • Verify icon displays in sidebar and connection form

@datlechin datlechin requested a review from Copilot March 5, 2026 18:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add CockroachDB support

2 participants