Krzysztof Wo¼nica ([EMAIL PROTECTED]) 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.todate IS 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


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to