| От | Nikolaus Thiel |
|---|---|
| Тема | [DOCS] Bad return type in example |
| Дата | |
| Msg-id | f37673c3-8786-b493-e244-93b7dc28028e@fsfe.org обсуждение |
| Ответы |
Re: [DOCS] Bad return type in example
|
| Список | pgsql-docs |
Dear Doc Writers,
Would it not be better to change the return type of the following two sample functions to numeric ?
CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno;
SELECT balance FROM bank WHERE accountno = tf1.accountno;
$$ LANGUAGE SQL;
CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno
RETURNING balance;
$$ LANGUAGE SQL;
Since debit is of type numeric, balance is (probably) numeric too, so the function ought to return numeric. I guess that the function works as it is using implicit type cast.
With best regards,
Nikolaus Thiel
В списке pgsql-docs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера