Key Concepts

What is Postgres Compatibility?

Run proven feature sets, tools, and frameworks at massive scale with cloud native capabilities

Every modern database now offers some level of Postgres compatibility to reach developers and increase adoption. But, even if a database claims compatibility, it can be difficult to decipher what that means in relation to another database, as not all “compatibility” is created equal.

Why Postgres Compatibility?

Postgres, also known formally as PostgreSQL, is the gold standard for operational databases. For starters, it has an expansive, proven feature set that most technologists know and love. It supports many “post-relational” database concepts, such as in-database functions. Specifically, these characteristics make it highly functional for a wide range of use cases and applications.

PostgreSQL adoption per DB-Engines ranking.

Additionally, it’s robust, fully extensible, and 100% open source. It is also supported by a vibrant community of developers—not to mention a rich ecosystem of tools and frameworks.

Defining Four Key Postgres Compatibility Metrics

Modern database vendors often neglect to mention that there are four key metrics—or “levels”—of Postgres compatibility. These metrics follow a natural adoption curve, from exploring a new database through to making a switch. Going further, the degree of compatibility isn’t all or nothing—databases can be higher or lower for any given metric. But, a database can only support an application to the degree it can support other forms of compatibility.

1. Wire-Protocol Compatibility

A PostgreSQL database reads some set of commands and queries off the network. These commands and queries are written in a sequence of bytes, and serialized. But a database is wire-protocol compatible if it can understand the same sequence and serialization of data.

PostgreSQL compatibility metric: wire compatibility

Wire-protocol compatibility allows Postgres client drivers to communicate with a database. This means developers can start building an application with ease. They’re able to write an application in a variety of programming languages, such as Java, JDBC, Python, and Go. Finally, developers can use command-line tools—such as psql—to connect to the database and explore any number of schemas or queries.

2. Syntax Compatibility

Wire compatibility deals with how a database sequences and serializes data. With syntax compatibility, a database can parse the same PostgreSQL syntax. In other words, when a valid Postgres snippet is sent to the database, it can create a table, execute a SQL statement, and return a valid result. The way it executes could be different, though. For example, in some cases, a specific set of parameters may be ignored.

With proper syntax, developers can use some of Postgres’ tools and frameworks. They simply send the necessary commands and the database understands what to do with it. 

3. Feature Compatibility

The feature compatibility metric means a database should be able to support the advanced features of PostgreSQL, beyond just ANSI SQL. Advanced features include triggers, partial indexes, and stored procedures.

An equivalent feature doesn’t need to have the same Postgres syntax to work.

However, in this instance, developers who rely on a certain Postgres feature would need to re-learn equivalent feature sets and modify their applications.

4. Runtime Compatibility

Runtime compatibility ensures a database matches PostgreSQL execution semantics at runtime. More specifically, runtime-compatible databases should support queries to the system catalog, error messages, and error codes.

This compatibility metric automatically implies the three other forms of compatibility—wire, syntax, and feature are in place. As a result, developers who know Postgres will feel at home from start to finish.

Postgres Compatibility is the Future

Whichever database you choose, higher compatibility with PostgreSQL provides a lower barrier to entry for developers, along with less mental friction. Therefore, applying compatibility metrics is critical to speed up (and future-proof) team adoption and productivity.

YugabyteDB reimagines Postgres for a cloud native world. Learn more about this powerful, open source database today through this free, self-paced course.

And finally, join our YugabyteDB Community Slack channel to answer any and all of your questions.