concat fails 'sometimes' on empty colums in select

From: Stefan de Konink <skinkie(at)xs4all(dot)nl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: concat fails 'sometimes' on empty colums in select
Date: 2004-12-11 02:33:07
Message-ID: 41BA5C63.4000603@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I have a table with some empty colums, if I try to concat my colums to
eachother something strange happens. Rather empty column B produces
virtually no output using the || in the select query. But the half filed
colum A does give the desired output.

midvliet=# select snr, achternaam||', '||voornaam||' '||tussenvoegsels,
tussenvoegsels, straatnaam||' '||huisnummer||' '||toevoeging,
postcodecijfers||' '||postcodeletters, woonplaats from naw;
snr | ?column? | tussenvoegsels | ?column? |
?column? | woonplaats
-----+-------------------------+----------------+-----------------+----------+--------------
18 | Konink, Stefan de | de | |
2265 CA | Leidschendam
19 | Köler, Julie | | |
2261 XK | Leidschendam

As you see two people one with 'tussenvoegsels' and one without. As you
also see neighter of those users has the next column.

midvliet=# select snr, achternaam, straatnaam||' '||huisnummer||'
'||toevoeging, straatnaam, huisnummer, toevoeging from naw;
snr | achternaam | ?column? | straatnaam |
huisnummer | toevoeging
-----+-------------+-----------------+------------------------------+------------+------------
18 | Konink | | Oude Trambaan |
7 |
19 | Köler | | Wildenborch |
81 |

Now if I enter some data in the 'toevoeging' column, it works. But this
behavior is not the same as previously with 'tussenvoegsels'.

midvliet=# \d naw
Table "public.naw"
Column | Type |
Modifiers
-----------------+-----------------------+------------------------------------------------------
snr | integer | not null default
nextval('public.naw_snr_seq'::text)
achternaam | character varying(25) |
voornaam | character varying(25) |
tussenvoegsels | character varying(10) |
straatnaam | character varying(50) |
huisnummer | smallint |
toevoeging | character varying(10) |
postcodecijfers | smallint |
postcodeletters | character(2) |
woonplaats | character varying(25) |
geboortedatum | date |
Indexes:
"naw_pkey" PRIMARY KEY, btree (snr)

I hope this is no stupid mistake of myself :)

Stefan de Konink

(Using Postgresql 8.0.0-rc1)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message SPA da Linha 2004-12-11 06:07:32 Voucher do SPA da LINHA e Accao Social
Previous Message Luojia Chen 2004-12-11 01:39:22 postgresql-8.0.0 beta5 & postgresql-7.4.6 can't compile successfully in Solaris 10 x86