Re: Problem with FOR SELECT in plpgsql function

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Problem with FOR SELECT in plpgsql function
Дата
Msg-id 200402201109.32849.dev@archonet.com
обсуждение исходный текст
Ответ на Problem with FOR SELECT in plpgsql function  (Plant Thomas <Thomas.Plant@lvh.it>)
Список pgsql-sql
On Friday 20 February 2004 10:07, Plant Thomas wrote:
> I have a problem with the following function:
[snip]
>
> This function sometimes returns null even if there is a record in the
> database for the corrisponding id.
> This happens only when there is only one record for the corrisponding id
> value in the database, if there
> are more than one record it works with no problem.

If it actually returns NULL and not the empty string, then the loop must be 
processed, since you set "uhrzeiten" to the empty string before the loop.

Two things to check:
1. None of your variables match a column in your select (and you seem OK 
here).
2. None of the fields in your expression are null (e.g. dat.vormittag_a)

I think it's #2 - concat NULL to any string and you get NULL back.


--  Richard Huxton Archonet Ltd


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

Предыдущее
От: Plant Thomas
Дата:
Сообщение: Problem with FOR SELECT in plpgsql function
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: pg_restore - don?t restore. Why?