Skip to content

Commit e738227

Browse files
author
Artur Zakirov
committed
Fix bug: EXC_BAD_ACCESS in Mac OS X
1 parent 13c6abf commit e738227

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

rumsort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,7 +3863,7 @@ copytup_rum(Tuplesortstate *state, SortTuple *stup, void *tup)
38633863
{
38643864
RumSortItem *item = (RumSortItem *)tup;
38653865

3866-
stup->datum1 = Float8GetDatum(item->data[0]);
3866+
stup->datum1 = Float8GetDatum(state->nKeys > 0 ? item->data[0] : 0);
38673867
stup->isnull1 = false;
38683868
stup->tuple = tup;
38693869
USEMEM(state, GetMemoryChunkSpace(tup));
@@ -3900,7 +3900,7 @@ readtup_rum(Tuplesortstate *state, SortTuple *stup,
39003900
USEMEM(state, GetMemoryChunkSpace(item));
39013901
LogicalTapeReadExact(state->tapeset, tapenum,
39023902
(void *)item, RumSortItemSize(state->nKeys));
3903-
stup->datum1 = Float8GetDatum(item->data[0]);
3903+
stup->datum1 = Float8GetDatum(state->nKeys > 0 ? item->data[0] : 0);
39043904
stup->isnull1 = false;
39053905
stup->tuple = item;
39063906

rumsort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typedef struct
6262
{
6363
ItemPointerData iptr;
6464
bool recheck;
65-
float8 data[1];
65+
float8 data[FLEXIBLE_ARRAY_MEMBER];
6666
} RumSortItem;
6767

6868
#define RumSortItemSize(nKeys) (offsetof(RumSortItem,data)+(nKeys)*sizeof(float8))

t/001_wal.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ sub test_index_replay
2323
my $queries = qq(SET enable_seqscan=off;
2424
SET enable_bitmapscan=on;
2525
SET enable_indexscan=on;
26-
SELECT * FROM tst WHERE i = 0;
27-
SELECT * FROM tst WHERE i = 3;
2826
SELECT * FROM tst WHERE t \@@ to_tsquery('simple', 'b');
2927
SELECT * FROM tst WHERE t \@@ to_tsquery('simple', 'f');
3028
SELECT * FROM tst WHERE i = 3 AND t \@@ to_tsquery('simple', 'c');

0 commit comments

Comments
 (0)