Re: BUG #8516: Calling VOLATILE from STABLE function

Поиск
Список
Период
Сортировка
От 'Bruce Momjian'
Тема Re: BUG #8516: Calling VOLATILE from STABLE function
Дата
Msg-id 20131010231546.GB7092@momjian.us
обсуждение исходный текст
Ответ на BUG #8516: Calling VOLATILE from STABLE function  (dwayne@docketnavigator.com)
Ответы Re: BUG #8516: Calling VOLATILE from STABLE function  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Список pgsql-bugs
On Thu, Oct 10, 2013 at 04:10:35PM -0700, Dwayne Towell wrote:
> > According to the documentation, f() should be marked VOLATILE also, since
> > calling f() produces side effects. PostgreSQL does not give a warning (or
> > better yet, an error); I think it should.
>
> I think the answer is that function authors are required to prevent
> functions they mark as STABLE from calling VOLATILE functions.
>
> --
>
> I understand it's an error (at least usually), my question/issue is why does
> PostgreSQL NOT give at least a warning when a programmer (probably
> accidentally) calls a VOLATILE function in one that he has specifically
> tagged as STABLE? The compiler has all the information to notify the
> programmer of a mistake, but isn't. This violates a fundamental principle of
> software engineering--take every opportunity to prevent errors.

Well, we can't walk the function tree to know all called functions, and
those they call, so we don't even try.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #8467: Slightly confusing pgcrypto example in docs
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: BUG #8467: Slightly confusing pgcrypto example in docs