BUG #5655: Composite Type Handles Null Incorrectly

Поиск
Список
Период
Сортировка
От Nate Carson
Тема BUG #5655: Composite Type Handles Null Incorrectly
Дата
Msg-id 201009140017.o8E0HIUA034470@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5655: Composite Type Handles Null Incorrectly  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5655
Logged by:          Nate Carson
Email address:      nate1001@gmail.com
PostgreSQL version: 8.4.4
Operating system:   linux 2.6.33-sabayon (gentoo)
Description:        Composite Type Handles Null Incorrectly
Details:

I have been using a composite type to handle the different fields of name
i.e. last name, first name, etc. This has been a good solution for handling
names that come from different formats while checking for duplicates.
However, I have found behavior that I do not believe is correct. Selecting
with a not null condition always returns 0 rows with null values for the
type, but querying 'is not null' in a column expression produces expected
results. I can coerce expected behavior by sub-querying 'is not null' on the
type in the inner query and select from the boolean condition in the outer
query.

Below is a script to reproduce behavior.


-- Composite Type Handles Null Incorrectly

drop type if exists t_person_test cascade;
create type t_
person_test as (
    fname   text,
    finit   char(1),
    mname   text,
    minit   char(1),
    lname   text,
    suffix  text
);

drop table if exists test;
create table test ( p t_person_test);
insert into test values
   (('Charles','C',null,null,'Dickens',null)::t_person_test),
    (null)
;

select p, p is null as pnull from test;

select * from test where p is null;

select * from (select p, p is null as pnull from test) as t where t.pnull =
false;
select * from (select p, p is null as pnull from test) as t where t.pnull =
true;

\echo 'This puts out 0 rows? Should output 1.'
select * from test where p is not null;

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 9.0 Bug: cannot build against python3.1, with two versions of python in the environment
Следующее
От: Michael Felt
Дата:
Сообщение: Re: Before I call it a bug - some comments and questions