Обсуждение: Is this a bug????

Поиск
Список
Период
Сортировка

Is this a bug????

От
Joost Kraaijeveld
Дата:
If I run this query:

select objectid,defaulttermsofpayment from prototype.customers
where
objectid = '336A0451-D9E8-7C11-6333-C17DF18E8979'

I get the following answer:

"336A0451-D9E8-7C11-6333-C17DF18E8979";"null"

If I run this query I get *no* results:

select objectid,defaulttermsofpayment from prototype.customers
where
defaulttermsofpayment is null

Is this a bug?


--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl

Re: Is this a bug????

От
"Qingqing Zhou"
Дата:
"Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl> wrote
>
> select objectid,defaulttermsofpayment from prototype.customers
> where
> objectid = '336A0451-D9E8-7C11-6333-C17DF18E8979'
>
> I get the following answer:
>
> "336A0451-D9E8-7C11-6333-C17DF18E8979";"null"
>

test=# create table m (c1 char(10), c2 char(10));
CREATE TABLE
test=# insert into m values('hello', null);
INSERT 0 1
test=# select * from m where c1 = 'hello';
     c1     | c2
------------+----
 hello      |
(1 row)
test=# select * from m where c2 is null;
     c1     | c2
------------+----
 hello      |
(1 row)

Notice if an column is null, then nothing is shown. So the strange thing is
how you get "null"?

Regards,
Qingqing

Re: Is this a bug????

От
Tom Lane
Дата:
Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl> writes:
> If I run this query:
> select objectid,defaulttermsofpayment from prototype.customers
> where
> objectid = '336A0451-D9E8-7C11-6333-C17DF18E8979'

> I get the following answer:

> "336A0451-D9E8-7C11-6333-C17DF18E8979";"null"

> If I run this query I get *no* results:

> select objectid,defaulttermsofpayment from prototype.customers
> where
> defaulttermsofpayment is null

> Is this a bug?

Not unless you can prove that the defaulttermsofpayment field is
actually null, and not the string "null" as it appears to be.

(What client-side software are you using?  psql wouldn't display
the row like that, nor anything else I'm familiar with.)

            regards, tom lane