mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Fix up several contrib modules that were using varlena datatypes in not-so-obvious
ways. I'm not totally sure that I caught everything, but at least now they pass their regression tests with VARSIZE/SET_VARSIZE defined to reverse byte order.
This commit is contained in:
@ -120,7 +120,7 @@ gtrgm_compress(PG_FUNCTION_ARGS)
|
||||
|
||||
len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
|
||||
res = (TRGM *) palloc(len);
|
||||
res->len = len;
|
||||
SET_VARSIZE(res, len);
|
||||
res->flag = SIGNKEY | ALLISTRUE;
|
||||
|
||||
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
|
||||
@ -235,10 +235,11 @@ gtrgm_union(PG_FUNCTION_ARGS)
|
||||
flag |= SIGNKEY;
|
||||
len = CALCGTSIZE(flag, 0);
|
||||
result = (TRGM *) palloc(len);
|
||||
*size = result->len = len;
|
||||
SET_VARSIZE(result, len);
|
||||
result->flag = flag;
|
||||
if (!ISALLTRUE(result))
|
||||
memcpy((void *) GETSIGN(result), (void *) base, sizeof(BITVEC));
|
||||
*size = len;
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
@ -486,26 +487,26 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
|
||||
if (cache[seed_1].allistrue)
|
||||
{
|
||||
datum_l = (TRGM *) palloc(CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
|
||||
datum_l->len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
|
||||
SET_VARSIZE(datum_l, CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
|
||||
datum_l->flag = SIGNKEY | ALLISTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
datum_l = (TRGM *) palloc(CALCGTSIZE(SIGNKEY, 0));
|
||||
datum_l->len = CALCGTSIZE(SIGNKEY, 0);
|
||||
SET_VARSIZE(datum_l, CALCGTSIZE(SIGNKEY, 0));
|
||||
datum_l->flag = SIGNKEY;
|
||||
memcpy((void *) GETSIGN(datum_l), (void *) cache[seed_1].sign, sizeof(BITVEC));
|
||||
}
|
||||
if (cache[seed_2].allistrue)
|
||||
{
|
||||
datum_r = (TRGM *) palloc(CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
|
||||
datum_r->len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
|
||||
SET_VARSIZE(datum_r, CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
|
||||
datum_r->flag = SIGNKEY | ALLISTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
datum_r = (TRGM *) palloc(CALCGTSIZE(SIGNKEY, 0));
|
||||
datum_r->len = CALCGTSIZE(SIGNKEY, 0);
|
||||
SET_VARSIZE(datum_r, CALCGTSIZE(SIGNKEY, 0));
|
||||
datum_r->flag = SIGNKEY;
|
||||
memcpy((void *) GETSIGN(datum_r), (void *) cache[seed_2].sign, sizeof(BITVEC));
|
||||
}
|
||||
|
Reference in New Issue
Block a user