470,581 Members | 2,433 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

Empty Output? How Do I Determine the Character?

I cannot determine what character is stored in a varchar...

For instance:
thedonnaholics=# select state from mailing_list where rec_num = 7;
state
-------

(1 row)

If I then execute:
thedonnaholics=# select count(*) from mailing_list where state = '';
count
-------
0
(1 row)

So, what is in that first row?

This also returns 0:
thedonnaholics=# select count(*) from mailing_list where state = ' ';
count
-------
0
(1 row)

Any ideas? I'd like to select all rows that contain whatever that first one
contains...

Hunter
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #1
2 1361
Hunter Hillegas <li***@lastonepicked.com> writes:
I cannot determine what character is stored in a varchar...
For instance:
thedonnaholics=# select state from mailing_list where rec_num = 7;
state
------- (1 row)


I'd say it's either NULL or between one and five space characters.
To find out, try something like

select '>' || state || '<' from mailing_list where rec_num = 7;

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #2
Ok... I don't think that it is null:
thedonnaholics=# select count(*) from mailing_list where state = null;
count
-------
0
(1 row)

I ran the query you suggested but I don't know what it means:
thedonnaholics=# select '>' || state || '<' from mailing_list where rec_num
= 7;
?column?
----------

(1 row)

Any insight appreciated.

Thanks,
Hunter
From: Tom Lane <tg*@sss.pgh.pa.us>
Date: Fri, 08 Aug 2003 19:03:24 -0400
To: Hunter Hillegas <li***@lastonepicked.com>
Cc: PostgreSQL <pg***********@postgresql.org>
Subject: Re: [GENERAL] Empty Output? How Do I Determine the Character?

Hunter Hillegas <li***@lastonepicked.com> writes:
I cannot determine what character is stored in a varchar...
For instance:
thedonnaholics=# select state from mailing_list where rec_num = 7;
state
-------

(1 row)


I'd say it's either NULL or between one and five space characters.
To find out, try something like

select '>' || state || '<' from mailing_list where rec_num = 7;

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Wayno | last post: by
3 posts views Thread by tornado | last post: by
5 posts views Thread by Michael | last post: by
7 posts views Thread by Clinton Pierce | last post: by
5 posts views Thread by Sen Haerens | last post: by
reply views Thread by jebbyleezer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.