This page points out differences in behavior between the PostgreSQL capabilities
supported in Spanner and their open source PostgreSQL
equivalents.

> [!CAUTION]
> **Caution:** The following specific behaviors may change to better align with open source PostgreSQL.

## Float8 underflow

In some cases, open source PostgreSQL returns an error such as
`ERROR: value out of range: underflow` if the result of floating point math
would be truncated to 0. Numbers too close to zero that are not representable as
distinct from zero cause an underflow error.

The PostgreSQL interface doesn't return an error in these cases;
it returns the truncated 0 value instead.

## concat function

In the PostgreSQL interface, the `concat()` function returns
NULL if any argument is NULL. However, in open source PostgreSQL,
this function ignores NULLs and returns a concatenation of all non-NULL
arguments, or an empty string if all arguments are NULL. For example:

```postgresql
-- Returns `abcdef` in open source PostgreSQL.
-- Returns NULL in the PostgreSQL interface.
select concat('abc', NULL, 'def');
```

The PostgreSQL interface and open source PostgreSQL have
identical behavior for the `||` operator with scalar (non-array) operands.

## array_cat() function

In the PostgreSQL interface, the `array_cat()` function returns
NULL if any argument is NULL. However, in open source PostgreSQL, this
function ignores NULLs and returns a concatenation of all non-NULL array
arguments, or a NULL array if all arguments are NULL. The same is true for the
`||` operator with array operands. For example:

    -- Returns `{abc, def}` in open source PostgreSQL.
    -- Returns NULL in the PostgreSQL interface.
    select '{abc}'::text[] || NULL::text[] || '{def}'::text[];

## array_to_string function

In the PostgreSQL interface, the `array_to_string(array text_array, delimiter text [, null_string text ])`
function returns NULL if the `null_string` argument is NULL. However, in
open source PostgreSQL, this function ignores the NULL array
elements and returns a concatenation of all non-NULL elements as a string
representation if the `null_string` argument is NULL. For example:

```sql
-- Returns `a,b,c` in open source PostgreSQL.
-- Returns NULL in the PostgreSQL interface.
select array_to_string('{a,b,NULL,c}'::text[], ',', NULL);
```

## Object names

For more information about naming issues, see [Name](https://docs.cloud.google.com/spanner/docs/reference/postgresql/data-definition-language.md.txt#names).

## HyperLogLog++ numeric sketch compatibility

In Spanner, HyperLogLog++ (`hll_count.*`) sketches initialized
from PostgreSQL
[`numeric`](https://docs.cloud.google.com/spanner/docs/reference/postgresql/data-types.md.txt) values are **not
mergeable** with sketches initialized from GoogleSQL
[`NUMERIC`](https://docs.cloud.google.com/spanner/docs/reference/standard-sql/data-types.md.txt#decimal_types)
values, due to differences in underlying data type representations between the
two SQL dialects.