Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit66c029c

Browse files
committed
Fix volatility markings of some contrib I/O functions.
In general, datatype I/O functions are supposed to be immutable or atworst stable. Some contrib I/O functions were, through oversight, notmarked with any volatility property at all, which made them VOLATILE.Since (most of) these functions actually behave immutably, the erroneousmarking isn't terribly harmful; but it can be user-visible in certaincircumstances, as per a recent bug report from Joe Van Dyk in which acast to text was disallowed in an expression index definition.To fix, just adjust the declarations in the extension SQL scripts. If wewere being very fussy about this, we'd bump the extension version numbers,but that seems like more trouble (for both developers and users) than theproblem is worth.A fly in the ointment is that chkpass_in actually is volatile, becauseof its use of random() to generate a fresh salt when presented with anot-yet-encrypted password. This is bad because of the general assumptionthat I/O functions aren't volatile: the consequence is that records orarrays containing chkpass elements may have input behavior a bit differentfrom a bare chkpass column. But there seems no way to fix this withoutbreaking existing usage patterns for chkpass, and the consequences of theinconsistency 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 inback-patching these fixes; at least future installations will get thefunctions marked correctly.
1 parente809fa2 commit66c029c

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

‎contrib/chkpass/chkpass--1.0.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
CREATEFUNCTIONchkpass_in(cstring)
1111
RETURNS chkpass
1212
AS'MODULE_PATHNAME'
13-
LANGUAGE C STRICT;
13+
LANGUAGE C STRICT VOLATILE;
14+
-- Note: chkpass_in actually is volatile, because of its use of random().
15+
-- In hindsight that was a bad idea, but there's no way to change it without
16+
-- breaking some usage patterns.
1417

1518
CREATEFUNCTIONchkpass_out(chkpass)
1619
RETURNS cstring
1720
AS'MODULE_PATHNAME'
18-
LANGUAGE C STRICT;
21+
LANGUAGE C STRICT IMMUTABLE;
1922

2023
CREATETYPEchkpass (
2124
internallength=16,

‎contrib/ltree/ltree--1.0.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
CREATEFUNCTIONltree_in(cstring)
77
RETURNS ltree
88
AS'MODULE_PATHNAME'
9-
LANGUAGE C STRICT;
9+
LANGUAGE C STRICT IMMUTABLE;
1010

1111
CREATEFUNCTIONltree_out(ltree)
1212
RETURNS cstring
1313
AS'MODULE_PATHNAME'
14-
LANGUAGE C STRICT;
14+
LANGUAGE C STRICT IMMUTABLE;
1515

1616
CREATETYPEltree (
1717
INTERNALLENGTH=-1,
@@ -303,12 +303,12 @@ CREATE OPERATOR CLASS ltree_ops
303303
CREATEFUNCTIONlquery_in(cstring)
304304
RETURNS lquery
305305
AS'MODULE_PATHNAME'
306-
LANGUAGE C STRICT;
306+
LANGUAGE C STRICT IMMUTABLE;
307307

308308
CREATEFUNCTIONlquery_out(lquery)
309309
RETURNS cstring
310310
AS'MODULE_PATHNAME'
311-
LANGUAGE C STRICT;
311+
LANGUAGE C STRICT IMMUTABLE;
312312

313313
CREATETYPElquery (
314314
INTERNALLENGTH=-1,
@@ -414,12 +414,12 @@ CREATE OPERATOR ^? (
414414
CREATEFUNCTIONltxtq_in(cstring)
415415
RETURNS ltxtquery
416416
AS'MODULE_PATHNAME'
417-
LANGUAGE C STRICT;
417+
LANGUAGE C STRICT IMMUTABLE;
418418

419419
CREATEFUNCTIONltxtq_out(ltxtquery)
420420
RETURNS cstring
421421
AS'MODULE_PATHNAME'
422-
LANGUAGE C STRICT;
422+
LANGUAGE C STRICT IMMUTABLE;
423423

424424
CREATETYPEltxtquery (
425425
INTERNALLENGTH=-1,
@@ -481,12 +481,12 @@ CREATE OPERATOR ^@ (
481481
CREATEFUNCTIONltree_gist_in(cstring)
482482
RETURNS ltree_gist
483483
AS'MODULE_PATHNAME'
484-
LANGUAGE C STRICT;
484+
LANGUAGE C STRICT IMMUTABLE;
485485

486486
CREATEFUNCTIONltree_gist_out(ltree_gist)
487487
RETURNS cstring
488488
AS'MODULE_PATHNAME'
489-
LANGUAGE C STRICT;
489+
LANGUAGE C STRICT IMMUTABLE;
490490

491491
CREATETYPEltree_gist (
492492
internallength=-1,

‎contrib/pg_trgm/pg_trgm--1.1.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ CREATE OPERATOR <-> (
5353
CREATEFUNCTIONgtrgm_in(cstring)
5454
RETURNS gtrgm
5555
AS'MODULE_PATHNAME'
56-
LANGUAGE C STRICT;
56+
LANGUAGE C STRICT IMMUTABLE;
5757

5858
CREATEFUNCTIONgtrgm_out(gtrgm)
5959
RETURNS cstring
6060
AS'MODULE_PATHNAME'
61-
LANGUAGE C STRICT;
61+
LANGUAGE C STRICT IMMUTABLE;
6262

6363
CREATETYPEgtrgm (
6464
INTERNALLENGTH=-1,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp