pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

Displaying NULL vs empty string

Open dirkgently007 opened this issue 11 years ago • 2 comments

pgcli displays an empty value as well as a NULL string in the same way.

e.g.

postgres> select NULL as null_str
+------------+
|   null_str |
|------------|
|            |
+------------+

postgres> select ' ' as empty_str
+-------------+
| empty_str   |
|-------------|
|             |
+-------------+

It would be great if there is a way to be able to differentiate these two cases.

FWIW, psql provides this via something like \pset null '<<NULL>>'

dirkgently007 avatar Mar 10 '15 04:03 dirkgently007

That is a valid request.

I've put in a fix in master.

misago_testforum> SELECT '' as empty_str;
+-------------+
| empty_str   |
|-------------|
|             |
+-------------+
SELECT 1
misago_testforum> SELECT NULL as null_str;
+------------+
|   null_str |
|------------|
|     <null> |
+------------+
SELECT 1

Can you verify?

You can install pgcli from master using the following command:

pip install -U -e git+https://github.com/amjith/pgcli.git#egg=pgcli

Thanks!

amjith avatar Mar 10 '15 06:03 amjith

Works perfectly! Thanks!

dirkgently007 avatar Mar 13 '15 15:03 dirkgently007