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

Commit9b681e2

Browse files
committed
Fix incorrect return value in brin_minmax_multi_distance_numeric().
The result of "DirectFunctionCall1(numeric_float8, d)" is already inDatum form, but the code was incorrectly applying PG_RETURN_FLOAT8()to it. On machines where float8 is pass-by-reference, this wouldresult in complete garbage, since an unpredictable pointer valuewould be treated as an integer and then converted to float. It's notentirely clear how much of a problem would ensue on 64-bit hardware,but certainly interpreting a float8 bitpattern as uint64 and thenconverting that to float isn't the intended behavior.As luck would have it, even the complete-garbage case doesn't breakBRIN indexes, since the results are only used to make choices abouthow to merge values into ranges: at worst, we'd make poor choicesresulting in an inefficient index. Doubtless that explains the lackof field complaints. However, users with BRIN indexes that use thenumeric_minmax_multi_ops opclass may wish to reindex in hopes ofmaking their indexes more efficient.Author: Peter Eisentraut <peter@eisentraut.org>Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/2093712.1753983215@sss.pgh.pa.usBackpatch-through: 14
1 parentf71ad5b commit9b681e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/backend/access/brin/brin_minmax_multi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ brin_minmax_multi_distance_numeric(PG_FUNCTION_ARGS)
20322032

20332033
d=DirectFunctionCall2(numeric_sub,a2,a1);/* a2 - a1 */
20342034

2035-
PG_RETURN_FLOAT8(DirectFunctionCall1(numeric_float8,d));
2035+
PG_RETURN_DATUM(DirectFunctionCall1(numeric_float8,d));
20362036
}
20372037

20382038
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp