Re: BUG #8516: Calling VOLATILE from STABLE function

From: "Dwayne Towell" <dwayne(at)docketnavigator(dot)com>
To: "'Bruce Momjian'" <bruce(at)momjian(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #8516: Calling VOLATILE from STABLE function
Date: 2013-10-10 23:10:35
Message-ID: 1c4601cec60d$ed9bfaa0$c8d3efe0$@docketnavigator.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> 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.

Dwayne

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2013-10-10 23:14:32 Re: BUG #8467: Slightly confusing pgcrypto example in docs
Previous Message Bruce Momjian 2013-10-10 22:59:31 Re: BUG #8516: Calling VOLATILE from STABLE function