Bug #862: strange select results - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #862: strange select results
Date
Msg-id 20030102105827.0AE43475A9E@postgresql.org
Whole thread Raw
Responses Re: Bug #862: strange select results  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Krzysztof Wo¼nica (kw@b3.4it.pl) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
strange select results

Long Description
I have created an view. When I select fields separately all looks ok but when I try to select 3 fields for concatention
(f1|| f2 || f3) the resul is empty when f3 is empty. I think it is not expected bahaviour. 


Sample Code
the view:
SELECT person.id, person.sex, person.salutation, person.firstname, person.secondname, person.lastname, person.birthday,
person.number,person.nip, (SELECT ((((((((address.street || ' '::text) || btrim((address.building)::text, ' '::text))
||'/'::text) || btrim((address.apartament)::text, ' '::text)) || ', '::text) || address.city) || ', '::text) ||
(address.country)::text)FROM address WHERE (((address.personid = person.id) AND (((address.fromdate <
'2003-01-02'::date)OR (address.todate IS NULL)) AND ((address.todate > '2003-01-02'::date) OR (address.todate IS
NULL))))AND (address."primary" = 't'::bool)) LIMIT 1) AS address, (SELECT contact.howto FROM contact WHERE
(((contact.personid= person.id) AND ((contact."type" = 'cel'::bpchar) OR (contact."type" = 'pho'::bpchar))) AND
(((contact.fromdate< '2003-01-02'::date) OR (contact.fromdate IS NULL)) AND ((contact.todate > '2003-01-02'::date) OR
(contact.todateIS NULL)))) LIMIT 1) AS phone, (SELECT contact.howto FROM contact 
  WHERE (((contact.personid = person.id) AND (contact."type" = 'eml'::bpchar)) AND (((contact.fromdate <
'2003-01-02'::date)OR (contact.fromdate IS NULL)) AND ((contact.todate > '2003-01-02'::date) OR (contact.todate IS
NULL))))LIMIT 1) AS email FROM person; 

forvhost=# select id, lastname, address from person_list;
 id  |               lastname                |            address
-----+---------------------------------------+--------------------------------
   2 | KKKKKKK                            |
   1 | WWWWW                            |
  92 | JJJJJJJJ                            | Kj Ji 1/1, Radom, PL
  93 | KAZKAZ                            |
  94 | 4IT S.A.                              |
  96 | Kowalski                              |
(6 rows)

forvhost=# select id, (lastname || '; ' || (address)::text)::text from person_list;
 id  |                    text
-----+--------------------------------------------
   2 |
   1 |
  92 | JJJJJJJJ; Kj Ji 1/1, Radom, PL
  93 |
  94 |
  96 |
(6 rows)


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #861: postgresql fails to build on FreeBSD/sparc64
Next
From: Tom Lane
Date:
Subject: Re: Bug #862: strange select results