Re: [HACKERS] lower() not working correctly...?

Поиск
Список
Период
Сортировка
От Ragnar
Тема Re: [HACKERS] lower() not working correctly...?
Дата
Msg-id 1158314825.17224.190.camel@localhost.localdomain
обсуждение исходный текст
Список pgsql-sql
On fös, 2006-09-15 at 09:52 +0200, Andreas Joseph Krogh wrote:
> I have the following query:
> 
> select lower(firstname) || ' ' || lower(lastname) from person
> 
> firstname and lastname are VARCHAR
> 
> lower() returns NULL when firstname OR lastname is NULL, is this correct?

In fact, your problem has nothing to do with lower().

You probably did not expect the || operator
to return NULL when any of the operands is NULL

as seen in 
select firstname || ' ' || lastname from person

so , as someone else has already mentioned,
you should use coalesce.

gnari




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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Omission of 'FROM' ? diff between pgsql 7.4.1 and pgsql 8.1.4
Следующее
От: Markus Schaber
Дата:
Сообщение: Re: Aggregates with internal state type?