| От | Tom Lane |
|---|---|
| Тема | Re: BUG #2389: function within function return value |
| Дата | |
| Msg-id | 21088.1144947075@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | BUG #2389: function within function return value ("James M Doherty" <jim@jdoherty.net>) |
| Список | pgsql-bugs |
"James M Doherty" <jim@jdoherty.net> writes:
> The above function is called as follows:
> trec.tot_value :=
> get_glaccttotals(RECORD_DATE,BANKID,''A500000'',''A500299'');
> The result is always null.
It's impossible to do much with this when you have not shown us a
complete test case, but I'm wondering if your calling function is
passing parameter values that don't match anything in the
bank_balance_sheet table. That would cause the sum() to return
null and then total_due would go to null as well.
It's pretty bogus that SQL defines sum() over no rows to return
null rather than zero, but the spec is perfectly clear about it.
You might want to change sum(bbs.bbs_current_balance) to
coalesce(sum(bbs.bbs_current_balance), 0) if you need to deal with
such situations.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера