In psql
, null
values are displayed as blank strings by default, which can be confusing to read.
However, you can customize this behavior by setting a specific character to represent null values, making your output more readable and easier to interpret:
\pset null '-x-'
All null
values will become -x-
, which is much more convenient.
anderson=# select * from test1;
name | surname
------+---------
A | -x-
(1 row)
Bonus
It’s possible to choose an emoji as a replacement:
anderson=# \pset null '⛔'
Null display is "⛔".
Then:
anderson=# select * from test1;
name | surname
------+---------
A | ⛔
(1 row)