> For the complete documentation index, see [llms.txt](https://docs.prestd.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prestd.com/databases/cockroachdb.md).

# CockroachDB

**pREST** can expose **CockroachDB** through the **Native** PostgreSQL adapter because CockroachDB implements the PostgreSQL wire protocol. Treat support as **Certified (PG wire)** with the matrix below — not identical to community PostgreSQL in every dialect detail.

*Last updated: July 11, 2026* · **Label:** Certified (PostgreSQL wire)

***

## Supported features

| Capability                        | Status                                               |
| --------------------------------- | ---------------------------------------------------- |
| Connection                        | supported (PG connection string / port)              |
| Schema discovery                  | supported (validate against your CRDB version)       |
| CRUD                              | supported for standard table operations              |
| Filtering / ordering / pagination | supported                                            |
| Transactions                      | supported with CockroachDB transaction semantics     |
| Scripts (`/_QUERIES`)             | supported for SQL accepted by CockroachDB            |
| MCP (`/_mcp`)                     | supported (v2.1.0+) when catalog/query paths succeed |
| ACL / permissions                 | supported (pREST ACL layer)                          |

***

## Connection

Default CockroachDB SQL port is often **26257**:

```sh
export PREST_VERSION=2
export PREST_PG_URL='postgres://root@localhost:26257/defaultdb?sslmode=disable'
```

For secure clusters, use TLS settings required by your deployment (`sslmode=verify-full`, client certs, etc.).

Docker smoke example (illustrative):

```sh
docker run -d --name crdb -p 26257:26257 cockroachdb/cockroach:latest start-single-node --insecure
docker run -d -p 3000:3000 \
  -e PREST_VERSION=2 \
  -e PREST_PG_URL='postgres://root@host.docker.internal:26257/defaultdb?sslmode=disable' \
  -e PREST_DEBUG=true \
  prest/prest:v2.4.2
```

Adjust host networking for your OS/Docker setup.

***

## CRUD example

**REST (Representational State Transfer)** maps HTTP verbs to CRUD on SQL tables at `/{database}/{schema}/{table}` — [API Reference](/api-reference.md).

```http
GET /defaultdb/public/users
```

***

## MCP

**MCP (Model Context Protocol)** is an open standard for connecting AI apps and agents to tools and data. Point MCP clients at the same `prestd` `/_mcp` endpoint — [MCP over HTTP](/get-started/mcp-over-http.md). Prefer a read-only DB role for agent traffic.

***

## Known limitations / incompatibilities

* Not every PostgreSQL extension or catalog quirk exists in CockroachDB.
* Some PostgreSQL-specific SQL (types, functions, `RETURNING` edge cases, advanced DDL) may fail; use [custom queries](/api-reference/custom-queries.md) only when CockroachDB accepts the SQL.
* Serial/identity and migration patterns differ from PostgreSQL — design schemas with CockroachDB docs in mind.
* Run your own integration checks before production; Phase 1 certification means **documented** use of the PG adapter, not a claim of 100% PostgreSQL parity.

***

## Related

* [Databases](/databases.md)
* [Acronyms](/readme/acronyms.md) ([REST](/readme/acronyms.md#rest), [MCP](/readme/acronyms.md#mcp))
* [PostgreSQL](/databases/postgresql.md)
* [YugabyteDB](/databases/yugabytedb.md)
* [Roadmap](/databases/roadmap.md)
