From: | Stuart Rison <stuart(at)ludwig(dot)ucl(dot)ac(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | [GENERAL] Making NULLs visible. |
Date: | 1998-10-09 09:53:34 |
Message-ID: | l03110727b2438933c9e6@[128.40.242.190] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dear All,
Is there a way to make postgreSQL 'show' nulls rather than have them appear
as blank fields?
e.g.
create table test (
code int2 primary key,
name text
);
insert into test (code,name) values (1234,'one two three four');
insert into test (code) values (5678);
insert into test (code,name) values (8888,NULL);
insert into test (code,name) values (9999,'');
now...
brecard5=> select * from test where name is null;
code|name
----+----
5678|
8888|
(2 rows)
brecard5=> select * from test;
code|name
----+------------------
1234|one two three four
5678|
9999|
8888|
(4 rows)
Question 1) How do I get postgres to do this:
select * from test;
code|name
----+------------------
1234|one two three four
5678|NULL
9999|
8888|NULL
?????
also, if I use the extended output option:
brecard5=> \x
turned on expanded table representation
brecard5=> select * from test where name is null;
Field| Value
-- RECORD 0 --
code| 5678
-- RECORD 1 --
code| 8888
(2 rows)
brecard5=> select * from test;
Field| Value
-- RECORD 0 --
code| 1234
name| one two three four
-- RECORD 1 --
code| 5678
-- RECORD 2 --
code| 9999
-- RECORD 3 --
code| 8888
(4 rows)
Again, how do I get visible NULLs?
Finally, as a somewhat unrelated set of questions:
2) In the extended output format, why is it that with 'select * from test',
RECORD 2 (code = 9999), the field name is not shown? Afterall, the field
is not null, just empty (which I know shouldn't really happen in a well
designed db but...)?
3) How do I get the extended output to list ALL fields, irrespective of
whether they contain a value or are NULL?
thanks for your help,
Stuart.
+-------------------------+--------------------------------------+
| Stuart Rison | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street |
| Tel. (0171) 878 4041 | London, W1P 8BT, UNITED KINGDOM. |
| Fax. (0171) 878 4040 | stuart(at)ludwig(dot)ucl(dot)ac(dot)uk |
+-------------------------+--------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-10-09 16:34:21 | Re: [GENERAL] How to drop entries in a table? |
Previous Message | Marc Eggenberger | 1998-10-09 08:23:57 | How to drop entries in a table? |