Menu

PostgreSQL Schema on CockroachDB: What It Refuses, What It Changes, and How to Check Yours
📰

PostgreSQL Schema on CockroachDB: What It Refuses, What It Changes, and How to Check Yours

DEV Community: postgres·Son Tran·5 days ago
#wnD01qPN
#devtopostgresql#devto#dev#cockroachdb#schema
Long article (1518 words) — no AI summary yet.
Reading 0:00
15s threshold

Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples.

TL;DR: A PostgreSQL schema rarely runs on CockroachDB unchanged. CockroachDB v26.3 has no range types, money , xml or point , no C collation, no DEFERRABLE foreign keys, and no BRIN, SP-GiST or EXCLUDE . It also changes what it accepts: integer becomes 64-bit, and a table created with serial gets 19-digit ids, past what JavaScript can hold exactly. Read the schema for these before moving any data.

CockroachDB accepts most of a PostgreSQL schema, refuses a specific list of types, indexes and constraints outright, and quietly changes two things it accepts: the size of integer and what serial means. The refusals are the easy part, because the statement fails and tells you. The quiet changes are the ones that reach production, such as an order id that a JavaScript client rounds to a different number.

Everything below ran in throwaway containers.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.