This document currently only covers unsupported SQL and how to rewrite SQL expressions. It does not discuss strategies for porting applications that use .
Unsupported Features
The following PostgreSQL features are not supported in CockroachDB v25.4:CREATE DOMAIN
CockroachDB does not support CREATE DOMAIN.
PostgreSQL range types
CockroachDB does not support PostgreSQL range types.Other unsupported features
- Events.
- Drop primary key.
Each table must have a primary key associated with it. You can .
- XML functions.
- Column-level privileges.
- XA syntax.
- Creating a database from a template.
- .
- Foreign data wrappers.
- Advisory Lock Functions (although some functions are defined with no-op implementations).
Partially Supported Features
The following PostgreSQL features are partially supported in CockroachDB v25.4.Multiple active portals
CockroachDB v25.4 supports pgwire’s multiple active portals as a . The feature is off by default, and can be enabled by setting the totrue.
When set to true, multiple portals can be open at the same time, with their execution interleaved with each other. In other words, these portals can be paused.
This feature has the following limitations:
- Only read-only without are supported.
- Postqueries (which are how CockroachDB executes , for example) are not supported
- is not supported for multiple active portals; instead queries execute on the only
- Only the latest execution of a statement from a pausable portal is recorded by the
Features that differ from PostgreSQL
Note, some of the differences below only apply to rare inputs, and so no change will be needed, even if the listed feature is being used. In these cases, it is safe to ignore the porting instructions.Overflow of float
In PostgreSQL, the float type returns an error when it overflows or an expression would return Infinity:
Precedence of unary ~
In PostgreSQL, the unary ~ (bitwise not) operator has a low precedence. For example, the following query is parsed as ~ (1 + 2) because ~ has a lower precedence than +:
~ has the same (high) precedence as unary -, so the above expression will be parsed as (~1) + 2.
Porting instructions: Manually add parentheses around expressions that depend on the PostgreSQL behavior.
Precedence of bitwise operators
In PostgreSQL, the operators| (bitwise OR), # (bitwise XOR), and & (bitwise AND) all have the same precedence.
In CockroachDB, the precedence from highest to lowest is: &, #, |.
Porting instructions: Manually add parentheses around expressions that depend on the PostgreSQL behavior.
Integer division
In PostgreSQL, division of integers results in an integer. For example, the following query returns1, since the 1 / 2 is truncated to 0:
decimal. CockroachDB instead provides the // operator to perform floor division.
Porting instructions: Change / to // in integer division where the result must be an integer.
Shift argument modulo
In PostgreSQL, the shift operators (<<, >>) sometimes modulo their second argument to the bit size of the underlying type. For example, the following query results in a 1 because the int type is 32 bits, and 32 % 32 is 0, so this is the equivalent of 1 << 0:
Locking and FOR UPDATE
CockroachDB supports the SELECT FOR UPDATE statement, which is used to order transactions by controlling concurrent access to one or more rows of a table.
For more information, see .
CHECK constraint validation for INSERT ON CONFLICT
CockroachDB validates constraints on the results of statements, preventing new or changed rows from violating the constraint. Unlike PostgreSQL, CockroachDB does not also validate CHECK constraints on the input rows of INSERT ON CONFLICT statements.
If this difference matters to your client, you can INSERT ON CONFLICT from a SELECT statement and check the inserted value as part of the SELECT. For example, instead of defining CHECK (x > 0) on t.x and using INSERT INTO t(x) VALUES (3) ON CONFLICT (x) DO UPDATE SET x = excluded.x, you could do the following:
x value less than 1 would result in the following error:
Column name from an outer column inside a subquery
CockroachDB returns the column name from an outer column inside a subquery as?column?, unlike PostgreSQL. For example:

