concat fails 'sometimes' on empty colums in select

Поиск
Список
Период
Сортировка
От Stefan de Konink
Тема concat fails 'sometimes' on empty colums in select
Дата
Msg-id 41BA5C63.4000603@xs4all.nl
обсуждение исходный текст
Ответы Re: concat fails 'sometimes' on empty colums in select  (Bruno Wolff III <bruno@wolff.to>)
Список 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)

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

Предыдущее
От: Luojia Chen
Дата:
Сообщение: postgresql-8.0.0 beta5 & postgresql-7.4.6 can't compile successfully in Solaris 10 x86
Следующее
От: "yoursoft@freemail.hu"
Дата:
Сообщение: Out of memory problem "More detailed"