PostgreSQL - empty values that are not null and not empty strings
11,431
t=# select ascii(chr(9));
ascii
-------
9
(1 row)
thus
select ascii(column) from table where column <>'' and column is not null
should give the idea
https://www.postgresql.org/docs/current/static/functions-string.html
ASCII code of the first character of the argument. For UTF8 returns the Unicode code point of the character. For other multibyte encodings, the argument must be an ASCII character.
Related videos on Youtube
Author by
JasonBK
Updated on June 04, 2022Comments
-
JasonBK almost 2 years
I ran this query on a PostgreSQL table:
select * wkt from table where column <>'' and column is not null
..and unexpectedly received several rows with no visible value in that column. Why is this? Is there some 'hidden' value in that column for those rows, or a corrupted table, or something else?
-
Vao Tsun over 6 yearsi belive many value will be invisible, eg ascii 0,1,2,3,4,5,6,7, depends on client though
-
dani herrera over 6 yearsOr just spaces.
-
Vao Tsun over 6 yearsyou check the first char with ascii function
-