pgsql: Fix volatility markings of some contrib I/O functions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix volatility markings of some contrib I/O functions.
Date: 2014-11-05 16:34:41
Message-ID: E1Xm3Xd-0008Py-Gx@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix volatility markings of some contrib I/O functions.

In general, datatype I/O functions are supposed to be immutable or at
worst stable. Some contrib I/O functions were, through oversight, not
marked with any volatility property at all, which made them VOLATILE.
Since (most of) these functions actually behave immutably, the erroneous
marking isn't terribly harmful; but it can be user-visible in certain
circumstances, as per a recent bug report from Joe Van Dyk in which a
cast to text was disallowed in an expression index definition.

To fix, just adjust the declarations in the extension SQL scripts. If we
were being very fussy about this, we'd bump the extension version numbers,
but that seems like more trouble (for both developers and users) than the
problem is worth.

A fly in the ointment is that chkpass_in actually is volatile, because
of its use of random() to generate a fresh salt when presented with a
not-yet-encrypted password. This is bad because of the general assumption
that I/O functions aren't volatile: the consequence is that records or
arrays containing chkpass elements may have input behavior a bit different
from a bare chkpass column. But there seems no way to fix this without
breaking existing usage patterns for chkpass, and the consequences of the
inconsistency don't seem bad enough to justify that. So for the moment,
just document it in a comment.

Since we're not bumping version numbers, there seems no harm in
back-patching these fixes; at least future installations will get the
functions marked correctly.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0247935c7b44526a2051184963b76cdd62ea0ab8

Modified Files
--------------
contrib/chkpass/chkpass--1.0.sql | 7 +++++--
contrib/ltree/ltree--1.0.sql | 16 ++++++++--------
contrib/pg_trgm/pg_trgm--1.1.sql | 4 ++--
3 files changed, 15 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-11-05 16:44:10 pgsql: Make CREATE TYPE print warnings if a datatype's I/O functions ar
Previous Message Tom Lane 2014-11-04 21:55:22 pgsql: Avoid integer overflow and buffer overrun in hstore_to_json().