Display User Friendly Text for NULL Values

By default YSQL will display NULL as an empty string which makes it impossible to distinguish NULL from a true empty string (i.e. ”) or a sequence of blanks.

If you want to quickly identify NULLs in your result set, try this:

				
					
yugabyte=# CREATE TABLE some_data (c VARCHAR);
CREATE TABLE

yugabyte=# INSERT INTO some_data VALUES ('A'), ('B'), (NULL), ('D'), ('E'), (NULL);
INSERT 0 6

yugabyte=# SELECT c FROM some_data;
 c
---
 E
 B

 D
 A

(6 rows)

yugabyte=# \pset null '(NULL)'
Null display is "(NULL)".

yugabyte=# SELECT c FROM some_data;
   c
--------
 E
 B
 (NULL)
 D
 A
 (NULL)
(6 rows)
				
			

Have Fun!