Clean up newlines following left parentheses

We used to strategically place newlines after some function call left
parentheses to make pgindent move the argument list a few chars to the
left, so that the whole line would fit under 80 chars.  However,
pgindent no longer does that, so the newlines just made the code
vertically longer for no reason.  Remove those newlines, and reflow some
of those lines for some extra naturality.

Reviewed-by: Michael Paquier, Tom Lane
Discussion: https://postgr.es/m/20200129200401.GA6303@alvherre.pgsql
This commit is contained in:
Alvaro Herrera 2020-01-30 13:42:14 -03:00
parent 4e89c79a52
commit c9d2977519
78 changed files with 342 additions and 538 deletions

View File

@ -114,8 +114,7 @@ gin_btree_compare_prefix(FunctionCallInfo fcinfo)
int32 res, int32 res,
cmp; cmp;
cmp = DatumGetInt32(CallerFInfoFunctionCall2( cmp = DatumGetInt32(CallerFInfoFunctionCall2(data->typecmp,
data->typecmp,
fcinfo->flinfo, fcinfo->flinfo,
PG_GET_COLLATION(), PG_GET_COLLATION(),
(data->strategy == BTLessStrategyNumber || (data->strategy == BTLessStrategyNumber ||
@ -463,8 +462,7 @@ gin_enum_cmp(PG_FUNCTION_ARGS)
} }
else else
{ {
res = DatumGetInt32(CallerFInfoFunctionCall2( res = DatumGetInt32(CallerFInfoFunctionCall2(enum_cmp,
enum_cmp,
fcinfo->flinfo, fcinfo->flinfo,
PG_GET_COLLATION(), PG_GET_COLLATION(),
ObjectIdGetDatum(a), ObjectIdGetDatum(a),

View File

@ -150,9 +150,9 @@ gbt_cash_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo,
); fcinfo->flinfo));
} }
@ -169,9 +169,8 @@ gbt_cash_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -202,11 +201,9 @@ gbt_cash_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_cash_picksplit(PG_FUNCTION_ARGS) gbt_cash_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -29,41 +29,42 @@ PG_FUNCTION_INFO_V1(gbt_date_same);
static bool static bool
gbt_dategt(const void *a, const void *b, FmgrInfo *flinfo) gbt_dategt(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(DirectFunctionCall2(date_gt,
DirectFunctionCall2(date_gt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b))) DateADTGetDatum(*((const DateADT *) a)),
); DateADTGetDatum(*((const DateADT *) b))));
} }
static bool static bool
gbt_datege(const void *a, const void *b, FmgrInfo *flinfo) gbt_datege(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(DirectFunctionCall2(date_ge,
DirectFunctionCall2(date_ge, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b))) DateADTGetDatum(*((const DateADT *) a)),
); DateADTGetDatum(*((const DateADT *) b))));
} }
static bool static bool
gbt_dateeq(const void *a, const void *b, FmgrInfo *flinfo) gbt_dateeq(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(DirectFunctionCall2(date_eq,
DirectFunctionCall2(date_eq, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b))) DateADTGetDatum(*((const DateADT *) a)),
DateADTGetDatum(*((const DateADT *) b)))
); );
} }
static bool static bool
gbt_datele(const void *a, const void *b, FmgrInfo *flinfo) gbt_datele(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(DirectFunctionCall2(date_le,
DirectFunctionCall2(date_le, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b))) DateADTGetDatum(*((const DateADT *) a)),
); DateADTGetDatum(*((const DateADT *) b))));
} }
static bool static bool
gbt_datelt(const void *a, const void *b, FmgrInfo *flinfo) gbt_datelt(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(DirectFunctionCall2(date_lt,
DirectFunctionCall2(date_lt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b))) DateADTGetDatum(*((const DateADT *) a)),
); DateADTGetDatum(*((const DateADT *) b))));
} }
@ -75,9 +76,13 @@ gbt_datekey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
dateKEY *ib = (dateKEY *) (((const Nsrt *) b)->t); dateKEY *ib = (dateKEY *) (((const Nsrt *) b)->t);
int res; int res;
res = DatumGetInt32(DirectFunctionCall2(date_cmp, DateADTGetDatum(ia->lower), DateADTGetDatum(ib->lower))); res = DatumGetInt32(DirectFunctionCall2(date_cmp,
DateADTGetDatum(ia->lower),
DateADTGetDatum(ib->lower)));
if (res == 0) if (res == 0)
return DatumGetInt32(DirectFunctionCall2(date_cmp, DateADTGetDatum(ia->upper), DateADTGetDatum(ib->upper))); return DatumGetInt32(DirectFunctionCall2(date_cmp,
DateADTGetDatum(ia->upper),
DateADTGetDatum(ib->upper)));
return res; return res;
} }
@ -162,9 +167,9 @@ gbt_date_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo,
); fcinfo->flinfo));
} }
@ -181,9 +186,8 @@ gbt_date_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -207,15 +211,13 @@ gbt_date_penalty(PG_FUNCTION_ARGS)
int32 diff, int32 diff,
res; res;
diff = DatumGetInt32(DirectFunctionCall2( diff = DatumGetInt32(DirectFunctionCall2(date_mi,
date_mi,
DateADTGetDatum(newentry->upper), DateADTGetDatum(newentry->upper),
DateADTGetDatum(origentry->upper))); DateADTGetDatum(origentry->upper)));
res = Max(diff, 0); res = Max(diff, 0);
diff = DatumGetInt32(DirectFunctionCall2( diff = DatumGetInt32(DirectFunctionCall2(date_mi,
date_mi,
DateADTGetDatum(origentry->lower), DateADTGetDatum(origentry->lower),
DateADTGetDatum(newentry->lower))); DateADTGetDatum(newentry->lower)));
@ -225,8 +227,7 @@ gbt_date_penalty(PG_FUNCTION_ARGS)
if (res > 0) if (res > 0)
{ {
diff = DatumGetInt32(DirectFunctionCall2( diff = DatumGetInt32(DirectFunctionCall2(date_mi,
date_mi,
DateADTGetDatum(origentry->upper), DateADTGetDatum(origentry->upper),
DateADTGetDatum(origentry->lower))); DateADTGetDatum(origentry->lower)));
*result += FLT_MIN; *result += FLT_MIN;
@ -241,11 +242,9 @@ gbt_date_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_date_picksplit(PG_FUNCTION_ARGS) gbt_date_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -31,16 +31,16 @@ PG_FUNCTION_INFO_V1(gbt_enum_same);
static bool static bool
gbt_enumgt(const void *a, const void *b, FmgrInfo *flinfo) gbt_enumgt(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(CallerFInfoFunctionCall2(enum_gt, flinfo, InvalidOid,
CallerFInfoFunctionCall2(enum_gt, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b))) ObjectIdGetDatum(*((const Oid *) a)),
); ObjectIdGetDatum(*((const Oid *) b))));
} }
static bool static bool
gbt_enumge(const void *a, const void *b, FmgrInfo *flinfo) gbt_enumge(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(CallerFInfoFunctionCall2(enum_ge, flinfo, InvalidOid,
CallerFInfoFunctionCall2(enum_ge, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b))) ObjectIdGetDatum(*((const Oid *) a)),
); ObjectIdGetDatum(*((const Oid *) b))));
} }
static bool static bool
gbt_enumeq(const void *a, const void *b, FmgrInfo *flinfo) gbt_enumeq(const void *a, const void *b, FmgrInfo *flinfo)
@ -50,16 +50,16 @@ gbt_enumeq(const void *a, const void *b, FmgrInfo *flinfo)
static bool static bool
gbt_enumle(const void *a, const void *b, FmgrInfo *flinfo) gbt_enumle(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(CallerFInfoFunctionCall2(enum_le, flinfo, InvalidOid,
CallerFInfoFunctionCall2(enum_le, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b))) ObjectIdGetDatum(*((const Oid *) a)),
); ObjectIdGetDatum(*((const Oid *) b))));
} }
static bool static bool
gbt_enumlt(const void *a, const void *b, FmgrInfo *flinfo) gbt_enumlt(const void *a, const void *b, FmgrInfo *flinfo)
{ {
return DatumGetBool( return DatumGetBool(CallerFInfoFunctionCall2(enum_lt, flinfo, InvalidOid,
CallerFInfoFunctionCall2(enum_lt, flinfo, InvalidOid, ObjectIdGetDatum(*((const Oid *) a)), ObjectIdGetDatum(*((const Oid *) b))) ObjectIdGetDatum(*((const Oid *) a)),
); ObjectIdGetDatum(*((const Oid *) b))));
} }
static int static int
@ -73,14 +73,14 @@ gbt_enumkey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
if (ia->upper == ib->upper) if (ia->upper == ib->upper)
return 0; return 0;
return DatumGetInt32( return DatumGetInt32(CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid,
CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid, ObjectIdGetDatum(ia->upper), ObjectIdGetDatum(ib->upper)) ObjectIdGetDatum(ia->upper),
); ObjectIdGetDatum(ib->upper)));
} }
return DatumGetInt32( return DatumGetInt32(CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid,
CallerFInfoFunctionCall2(enum_cmp, flinfo, InvalidOid, ObjectIdGetDatum(ia->lower), ObjectIdGetDatum(ib->lower)) ObjectIdGetDatum(ia->lower),
); ObjectIdGetDatum(ib->lower)));
} }
static const gbtree_ninfo tinfo = static const gbtree_ninfo tinfo =
@ -137,9 +137,9 @@ gbt_enum_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo,
); fcinfo->flinfo));
} }
Datum Datum
@ -168,11 +168,9 @@ gbt_enum_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_enum_picksplit(PG_FUNCTION_ARGS) gbt_enum_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -143,9 +143,9 @@ gbt_float4_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo,
); fcinfo->flinfo));
} }
@ -162,9 +162,8 @@ gbt_float4_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -195,11 +194,9 @@ gbt_float4_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_float4_picksplit(PG_FUNCTION_ARGS) gbt_float4_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -150,9 +150,9 @@ gbt_float8_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo,
); fcinfo->flinfo));
} }
@ -169,9 +169,8 @@ gbt_float8_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -202,11 +201,9 @@ gbt_float8_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_float8_picksplit(PG_FUNCTION_ARGS) gbt_float8_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -171,11 +171,9 @@ gbt_inet_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_inet_picksplit(PG_FUNCTION_ARGS) gbt_inet_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -150,9 +150,8 @@ gbt_int2_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -169,9 +168,8 @@ gbt_int2_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -201,11 +199,9 @@ gbt_int2_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_int2_picksplit(PG_FUNCTION_ARGS) gbt_int2_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -151,9 +151,8 @@ gbt_int4_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -170,9 +169,8 @@ gbt_int4_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -202,11 +200,9 @@ gbt_int4_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_int4_picksplit(PG_FUNCTION_ARGS) gbt_int4_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -151,9 +151,8 @@ gbt_int8_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -170,9 +169,8 @@ gbt_int8_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -202,11 +200,9 @@ gbt_int8_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_int8_picksplit(PG_FUNCTION_ARGS) gbt_int8_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -225,9 +225,8 @@ gbt_intv_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) query, &strategy,
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -244,9 +243,8 @@ gbt_intv_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -284,11 +282,9 @@ gbt_intv_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_intv_picksplit(PG_FUNCTION_ARGS) gbt_intv_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -141,9 +141,8 @@ gbt_macad_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) query, &strategy,
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -181,11 +180,9 @@ gbt_macad_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_macad_picksplit(PG_FUNCTION_ARGS) gbt_macad_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -141,9 +141,8 @@ gbt_macad8_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) query, &strategy,
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -181,11 +180,9 @@ gbt_macad8_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_macad8_picksplit(PG_FUNCTION_ARGS) gbt_macad8_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -174,23 +174,17 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS)
ok = gbt_var_key_readable(org); ok = gbt_var_key_readable(org);
uk = gbt_var_key_readable((GBT_VARKEY *) DatumGetPointer(uni)); uk = gbt_var_key_readable((GBT_VARKEY *) DatumGetPointer(uni));
us = DatumGetNumeric(DirectFunctionCall2( us = DatumGetNumeric(DirectFunctionCall2(numeric_sub,
numeric_sub,
PointerGetDatum(uk.upper), PointerGetDatum(uk.upper),
PointerGetDatum(uk.lower) PointerGetDatum(uk.lower)));
));
os = DatumGetNumeric(DirectFunctionCall2( os = DatumGetNumeric(DirectFunctionCall2(numeric_sub,
numeric_sub,
PointerGetDatum(ok.upper), PointerGetDatum(ok.upper),
PointerGetDatum(ok.lower) PointerGetDatum(ok.lower)));
));
ds = DatumGetNumeric(DirectFunctionCall2( ds = DatumGetNumeric(DirectFunctionCall2(numeric_sub,
numeric_sub,
NumericGetDatum(us), NumericGetDatum(us),
NumericGetDatum(os) NumericGetDatum(os)));
));
if (numeric_is_nan(us)) if (numeric_is_nan(us))
{ {
@ -208,11 +202,9 @@ gbt_numeric_penalty(PG_FUNCTION_ARGS)
if (DirectFunctionCall2(numeric_gt, NumericGetDatum(ds), NumericGetDatum(nul))) if (DirectFunctionCall2(numeric_gt, NumericGetDatum(ds), NumericGetDatum(nul)))
{ {
*result += FLT_MIN; *result += FLT_MIN;
os = DatumGetNumeric(DirectFunctionCall2( os = DatumGetNumeric(DirectFunctionCall2(numeric_div,
numeric_div,
NumericGetDatum(ds), NumericGetDatum(ds),
NumericGetDatum(us) NumericGetDatum(us)));
));
*result += (float4) DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow, NumericGetDatum(os))); *result += (float4) DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow, NumericGetDatum(os)));
} }
} }

View File

@ -151,9 +151,8 @@ gbt_oid_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -170,9 +169,8 @@ gbt_oid_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -202,11 +200,9 @@ gbt_oid_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_oid_picksplit(PG_FUNCTION_ARGS) gbt_oid_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -216,9 +216,8 @@ gbt_time_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
Datum Datum
@ -234,9 +233,8 @@ gbt_time_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
Datum Datum
@ -260,9 +258,8 @@ gbt_timetz_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &qqq, &strategy,
gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
@ -287,15 +284,13 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
double res; double res;
double res2; double res2;
intr = DatumGetIntervalP(DirectFunctionCall2( intr = DatumGetIntervalP(DirectFunctionCall2(time_mi_time,
time_mi_time,
TimeADTGetDatumFast(newentry->upper), TimeADTGetDatumFast(newentry->upper),
TimeADTGetDatumFast(origentry->upper))); TimeADTGetDatumFast(origentry->upper)));
res = INTERVAL_TO_SEC(intr); res = INTERVAL_TO_SEC(intr);
res = Max(res, 0); res = Max(res, 0);
intr = DatumGetIntervalP(DirectFunctionCall2( intr = DatumGetIntervalP(DirectFunctionCall2(time_mi_time,
time_mi_time,
TimeADTGetDatumFast(origentry->lower), TimeADTGetDatumFast(origentry->lower),
TimeADTGetDatumFast(newentry->lower))); TimeADTGetDatumFast(newentry->lower)));
res2 = INTERVAL_TO_SEC(intr); res2 = INTERVAL_TO_SEC(intr);
@ -307,8 +302,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
if (res > 0) if (res > 0)
{ {
intr = DatumGetIntervalP(DirectFunctionCall2( intr = DatumGetIntervalP(DirectFunctionCall2(time_mi_time,
time_mi_time,
TimeADTGetDatumFast(origentry->upper), TimeADTGetDatumFast(origentry->upper),
TimeADTGetDatumFast(origentry->lower))); TimeADTGetDatumFast(origentry->lower)));
*result += FLT_MIN; *result += FLT_MIN;
@ -323,11 +317,9 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_time_picksplit(PG_FUNCTION_ARGS) gbt_time_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -265,9 +265,8 @@ gbt_ts_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy,
gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
Datum Datum
@ -283,9 +282,8 @@ gbt_ts_distance(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
Datum Datum
@ -308,9 +306,8 @@ gbt_tstz_consistent(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk[MAXALIGN(tinfo.size)]; key.upper = (GBT_NUMKEY *) &kkk[MAXALIGN(tinfo.size)];
qqq = tstz_to_ts_gmt(query); qqq = tstz_to_ts_gmt(query);
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &qqq, &strategy,
gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) GIST_LEAF(entry), &tinfo, fcinfo->flinfo));
);
} }
Datum Datum
@ -328,9 +325,8 @@ gbt_tstz_distance(PG_FUNCTION_ARGS)
key.upper = (GBT_NUMKEY *) &kkk[MAXALIGN(tinfo.size)]; key.upper = (GBT_NUMKEY *) &kkk[MAXALIGN(tinfo.size)];
qqq = tstz_to_ts_gmt(query); qqq = tstz_to_ts_gmt(query);
PG_RETURN_FLOAT8( PG_RETURN_FLOAT8(gbt_num_distance(&key, (void *) &qqq, GIST_LEAF(entry),
gbt_num_distance(&key, (void *) &qqq, GIST_LEAF(entry), &tinfo, fcinfo->flinfo) &tinfo, fcinfo->flinfo));
);
} }
@ -387,11 +383,9 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_ts_picksplit(PG_FUNCTION_ARGS) gbt_ts_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -190,10 +190,9 @@ gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo *tinf
static bool static bool
gbt_var_node_pf_match(const GBT_VARKEY_R *node, const bytea *query, const gbtree_vinfo *tinfo) gbt_var_node_pf_match(const GBT_VARKEY_R *node, const bytea *query, const gbtree_vinfo *tinfo)
{ {
return (tinfo->trnc && ( return (tinfo->trnc &&
gbt_bytea_pf_match(node->lower, query, tinfo) || (gbt_bytea_pf_match(node->lower, query, tinfo) ||
gbt_bytea_pf_match(node->upper, query, tinfo) gbt_bytea_pf_match(node->upper, query, tinfo)));
));
} }

View File

@ -148,10 +148,9 @@ gbt_uuid_consistent(PG_FUNCTION_ARGS)
key.lower = (GBT_NUMKEY *) &kkk->lower; key.lower = (GBT_NUMKEY *) &kkk->lower;
key.upper = (GBT_NUMKEY *) &kkk->upper; key.upper = (GBT_NUMKEY *) &kkk->upper;
PG_RETURN_BOOL( PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) query, &strategy,
gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo,
GIST_LEAF(entry), &tinfo, fcinfo->flinfo) fcinfo->flinfo));
);
} }
Datum Datum
@ -219,11 +218,9 @@ gbt_uuid_penalty(PG_FUNCTION_ARGS)
Datum Datum
gbt_uuid_picksplit(PG_FUNCTION_ARGS) gbt_uuid_picksplit(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(gbt_num_picksplit( PG_RETURN_POINTER(gbt_num_picksplit((GistEntryVector *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1), (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
&tinfo, fcinfo->flinfo &tinfo, fcinfo->flinfo));
));
} }
Datum Datum

View File

@ -717,14 +717,10 @@ cube_union_v0(NDBOX *a, NDBOX *b)
/* First compute the union of the dimensions present in both args */ /* First compute the union of the dimensions present in both args */
for (i = 0; i < DIM(b); i++) for (i = 0; i < DIM(b); i++)
{ {
result->x[i] = Min( result->x[i] = Min(Min(LL_COORD(a, i), UR_COORD(a, i)),
Min(LL_COORD(a, i), UR_COORD(a, i)), Min(LL_COORD(b, i), UR_COORD(b, i)));
Min(LL_COORD(b, i), UR_COORD(b, i)) result->x[i + DIM(a)] = Max(Max(LL_COORD(a, i), UR_COORD(a, i)),
); Max(LL_COORD(b, i), UR_COORD(b, i)));
result->x[i + DIM(a)] = Max(
Max(LL_COORD(a, i), UR_COORD(a, i)),
Max(LL_COORD(b, i), UR_COORD(b, i))
);
} }
/* continue on the higher dimensions only present in 'a' */ /* continue on the higher dimensions only present in 'a' */
for (; i < DIM(a); i++) for (; i < DIM(a); i++)
@ -796,14 +792,10 @@ cube_inter(PG_FUNCTION_ARGS)
/* First compute intersection of the dimensions present in both args */ /* First compute intersection of the dimensions present in both args */
for (i = 0; i < DIM(b); i++) for (i = 0; i < DIM(b); i++)
{ {
result->x[i] = Max( result->x[i] = Max(Min(LL_COORD(a, i), UR_COORD(a, i)),
Min(LL_COORD(a, i), UR_COORD(a, i)), Min(LL_COORD(b, i), UR_COORD(b, i)));
Min(LL_COORD(b, i), UR_COORD(b, i)) result->x[i + DIM(a)] = Min(Max(LL_COORD(a, i), UR_COORD(a, i)),
); Max(LL_COORD(b, i), UR_COORD(b, i)));
result->x[i + DIM(a)] = Min(
Max(LL_COORD(a, i), UR_COORD(a, i)),
Max(LL_COORD(b, i), UR_COORD(b, i))
);
} }
/* continue on the higher dimensions only present in 'a' */ /* continue on the higher dimensions only present in 'a' */
for (; i < DIM(a); i++) for (; i < DIM(a); i++)

View File

@ -905,8 +905,7 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res)
if (!is_sql_cmd) if (!is_sql_cmd)
nestlevel = applyRemoteGucs(conn); nestlevel = applyRemoteGucs(conn);
oldcontext = MemoryContextSwitchTo( oldcontext = MemoryContextSwitchTo(rsinfo->econtext->ecxt_per_query_memory);
rsinfo->econtext->ecxt_per_query_memory);
tupstore = tuplestore_begin_heap(true, false, work_mem); tupstore = tuplestore_begin_heap(true, false, work_mem);
rsinfo->setResult = tupstore; rsinfo->setResult = tupstore;
rsinfo->setDesc = tupdesc; rsinfo->setDesc = tupdesc;
@ -1027,8 +1026,7 @@ materializeQueryResult(FunctionCallInfo fcinfo,
TEXTOID, -1, 0); TEXTOID, -1, 0);
attinmeta = TupleDescGetAttInMetadata(tupdesc); attinmeta = TupleDescGetAttInMetadata(tupdesc);
oldcontext = MemoryContextSwitchTo( oldcontext = MemoryContextSwitchTo(rsinfo->econtext->ecxt_per_query_memory);
rsinfo->econtext->ecxt_per_query_memory);
tupstore = tuplestore_begin_heap(true, false, work_mem); tupstore = tuplestore_begin_heap(true, false, work_mem);
rsinfo->setResult = tupstore; rsinfo->setResult = tupstore;
rsinfo->setDesc = tupdesc; rsinfo->setDesc = tupdesc;

View File

@ -531,8 +531,7 @@ DoubleMetaphone(char *str, char **codes)
} }
/* germanic, greek, or otherwise 'ch' for 'kh' sound */ /* germanic, greek, or otherwise 'ch' for 'kh' sound */
if ( if ((StringAt(original, 0, 4, "VAN ", "VON ", "")
(StringAt(original, 0, 4, "VAN ", "VON ", "")
|| StringAt(original, 0, 3, "SCH", "")) || StringAt(original, 0, 3, "SCH", ""))
/* 'architect but not 'arch', 'orchestra', 'orchid' */ /* 'architect but not 'arch', 'orchestra', 'orchid' */
|| StringAt(original, (current - 2), 6, "ORCHES", || StringAt(original, (current - 2), 6, "ORCHES",
@ -606,8 +605,7 @@ DoubleMetaphone(char *str, char **codes)
&& !StringAt(original, (current + 2), 2, "HU", "")) && !StringAt(original, (current + 2), 2, "HU", ""))
{ {
/* 'accident', 'accede' 'succeed' */ /* 'accident', 'accede' 'succeed' */
if ( if (((current == 1)
((current == 1)
&& (GetAt(original, current - 1) == 'A')) && (GetAt(original, current - 1) == 'A'))
|| StringAt(original, (current - 1), 5, "UCCEE", || StringAt(original, (current - 1), 5, "UCCEE",
"UCCES", "")) "UCCES", ""))
@ -754,8 +752,7 @@ DoubleMetaphone(char *str, char **codes)
* Parker's rule (with some further refinements) - e.g., * Parker's rule (with some further refinements) - e.g.,
* 'hugh' * 'hugh'
*/ */
if ( if (((current > 1)
((current > 1)
&& StringAt(original, (current - 2), 1, && StringAt(original, (current - 2), 1,
"B", "H", "D", "")) "B", "H", "D", ""))
/* e.g., 'bough' */ /* e.g., 'bough' */
@ -848,14 +845,12 @@ DoubleMetaphone(char *str, char **codes)
} }
/* -ger-, -gy- */ /* -ger-, -gy- */
if ( if ((StringAt(original, (current + 1), 2, "ER", "")
(StringAt(original, (current + 1), 2, "ER", "")
|| (GetAt(original, current + 1) == 'Y')) || (GetAt(original, current + 1) == 'Y'))
&& !StringAt(original, 0, 6, && !StringAt(original, 0, 6,
"DANGER", "RANGER", "MANGER", "") "DANGER", "RANGER", "MANGER", "")
&& !StringAt(original, (current - 1), 1, "E", "I", "") && !StringAt(original, (current - 1), 1, "E", "I", "")
&& !StringAt(original, (current - 1), 3, "RGY", "OGY", && !StringAt(original, (current - 1), 3, "RGY", "OGY", ""))
""))
{ {
MetaphAdd(primary, "K"); MetaphAdd(primary, "K");
MetaphAdd(secondary, "J"); MetaphAdd(secondary, "J");
@ -869,8 +864,7 @@ DoubleMetaphone(char *str, char **codes)
"AGGI", "OGGI", "")) "AGGI", "OGGI", ""))
{ {
/* obvious germanic */ /* obvious germanic */
if ( if ((StringAt(original, 0, 4, "VAN ", "VON ", "")
(StringAt(original, 0, 4, "VAN ", "VON ", "")
|| StringAt(original, 0, 3, "SCH", "")) || StringAt(original, 0, 3, "SCH", ""))
|| StringAt(original, (current + 1), 2, "ET", "")) || StringAt(original, (current + 1), 2, "ET", ""))
{ {

View File

@ -612,9 +612,9 @@ hstore_slice_to_array(PG_FUNCTION_ARGS)
} }
else else
{ {
out_datums[i] = PointerGetDatum( out_datums[i] =
cstring_to_text_with_len(HSTORE_VAL(entries, ptr, idx), PointerGetDatum(cstring_to_text_with_len(HSTORE_VAL(entries, ptr, idx),
HSTORE_VALLEN(entries, idx))); HSTORE_VALLEN(entries, idx)));
out_nulls[i] = false; out_nulls[i] = false;
} }
} }

View File

@ -45,13 +45,9 @@ _int_contains(PG_FUNCTION_ARGS)
Datum Datum
_int_different(PG_FUNCTION_ARGS) _int_different(PG_FUNCTION_ARGS)
{ {
PG_RETURN_BOOL(!DatumGetBool( PG_RETURN_BOOL(!DatumGetBool(DirectFunctionCall2(_int_same,
DirectFunctionCall2(
_int_same,
PointerGetDatum(PG_GETARG_POINTER(0)), PointerGetDatum(PG_GETARG_POINTER(0)),
PointerGetDatum(PG_GETARG_POINTER(1)) PointerGetDatum(PG_GETARG_POINTER(1)))));
)
));
} }
Datum Datum

View File

@ -446,11 +446,9 @@ gist_qtxt(ltree_gist *key, ltxtquery *query)
if (LTG_ISALLTRUE(key)) if (LTG_ISALLTRUE(key))
return true; return true;
return ltree_execute( return ltree_execute(GETQUERY(query),
GETQUERY(query),
(void *) LTG_SIGN(key), false, (void *) LTG_SIGN(key), false,
checkcondition_bit checkcondition_bit);
);
} }
static bool static bool

View File

@ -65,11 +65,7 @@ compare_subnode(ltree_level *t, char *qn, int len, int (*cmpptr) (const char *,
isok = false; isok = false;
while ((tn = getlexeme(tn, endt, &lent)) != NULL) while ((tn = getlexeme(tn, endt, &lent)) != NULL)
{ {
if ( if ((lent == lenq || (lent > lenq && anyend)) &&
(
lent == lenq ||
(lent > lenq && anyend)
) &&
(*cmpptr) (qn, tn, lenq) == 0) (*cmpptr) (qn, tn, lenq) == 0)
{ {
@ -118,11 +114,8 @@ checkLevel(lquery_level *curq, ltree_level *curt)
if (compare_subnode(curt, curvar->name, curvar->len, cmpptr, (curvar->flag & LVAR_ANYEND))) if (compare_subnode(curt, curvar->name, curvar->len, cmpptr, (curvar->flag & LVAR_ANYEND)))
return true; return true;
} }
else if ( else if ((curvar->len == curt->len ||
( (curt->len > curvar->len && (curvar->flag & LVAR_ANYEND))) &&
curvar->len == curt->len ||
(curt->len > curvar->len && (curvar->flag & LVAR_ANYEND))
) &&
(*cmpptr) (curvar->name, curt->name, curvar->len) == 0) (*cmpptr) (curvar->name, curt->name, curvar->len) == 0)
{ {

View File

@ -258,10 +258,8 @@ typedef struct rix
static int static int
treekey_cmp(const void *a, const void *b) treekey_cmp(const void *a, const void *b)
{ {
return ltree_compare( return ltree_compare(((const RIX *) a)->r,
((const RIX *) a)->r, ((const RIX *) b)->r);
((const RIX *) b)->r
);
} }
@ -571,11 +569,9 @@ gist_qtxt(ltree_gist *key, ltxtquery *query)
if (LTG_ISALLTRUE(key)) if (LTG_ISALLTRUE(key))
return true; return true;
return ltree_execute( return ltree_execute(GETQUERY(query),
GETQUERY(query),
(void *) LTG_SIGN(key), false, (void *) LTG_SIGN(key), false,
checkcondition_bit checkcondition_bit);
);
} }
static bool static bool
@ -636,11 +632,9 @@ ltree_consistent(PG_FUNCTION_ARGS)
if (GIST_LEAF(entry)) if (GIST_LEAF(entry))
res = (ltree_compare((ltree *) query, LTG_NODE(key)) == 0); res = (ltree_compare((ltree *) query, LTG_NODE(key)) == 0);
else else
res = ( res = (ltree_compare((ltree *) query, LTG_GETLNODE(key)) >= 0
ltree_compare((ltree *) query, LTG_GETLNODE(key)) >= 0
&& &&
ltree_compare((ltree *) query, LTG_GETRNODE(key)) <= 0 ltree_compare((ltree *) query, LTG_GETRNODE(key)) <= 0);
);
break; break;
case BTGreaterEqualStrategyNumber: case BTGreaterEqualStrategyNumber:
query = PG_GETARG_LTREE_P(1); query = PG_GETARG_LTREE_P(1);

View File

@ -68,11 +68,8 @@ checkcondition_str(void *checkval, ITEM *val)
if (compare_subnode(level, op, val->length, cmpptr, (val->flag & LVAR_ANYEND))) if (compare_subnode(level, op, val->length, cmpptr, (val->flag & LVAR_ANYEND)))
return true; return true;
} }
else if ( else if ((val->length == level->len ||
( (level->len > val->length && (val->flag & LVAR_ANYEND))) &&
val->length == level->len ||
(level->len > val->length && (val->flag & LVAR_ANYEND))
) &&
(*cmpptr) (op, level->name, val->length) == 0) (*cmpptr) (op, level->name, val->length) == 0)
return true; return true;
@ -94,12 +91,10 @@ ltxtq_exec(PG_FUNCTION_ARGS)
chkval.node = val; chkval.node = val;
chkval.operand = GETOPERAND(query); chkval.operand = GETOPERAND(query);
result = ltree_execute( result = ltree_execute(GETQUERY(query),
GETQUERY(query),
&chkval, &chkval,
true, true,
checkcondition_str checkcondition_str);
);
PG_FREE_IF_COPY(val, 0); PG_FREE_IF_COPY(val, 0);
PG_FREE_IF_COPY(query, 1); PG_FREE_IF_COPY(query, 1);

View File

@ -545,8 +545,7 @@ sql_exec_searchtables(PGconn *conn, struct options *opts)
free(comma_filenodes); free(comma_filenodes);
/* now build the query */ /* now build the query */
todo = psprintf( todo = psprintf("SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
"SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
"FROM pg_catalog.pg_class c\n" "FROM pg_catalog.pg_class c\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
" LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n" " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n"

View File

@ -250,8 +250,7 @@ heap_page_items(PG_FUNCTION_ARGS)
bits_len = bits_len =
BITMAPLEN(HeapTupleHeaderGetNatts(tuphdr)) * BITS_PER_BYTE; BITMAPLEN(HeapTupleHeaderGetNatts(tuphdr)) * BITS_PER_BYTE;
values[11] = CStringGetTextDatum( values[11] = CStringGetTextDatum(bits_to_text(tuphdr->t_bits, bits_len));
bits_to_text(tuphdr->t_bits, bits_len));
} }
else else
nulls[11] = true; nulls[11] = true;

View File

@ -878,9 +878,9 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
if (ISALLTRUE(datum_l) && cache[j].allistrue) if (ISALLTRUE(datum_l) && cache[j].allistrue)
size_alpha = 0; size_alpha = 0;
else else
size_alpha = SIGLENBIT - sizebitvec( size_alpha = SIGLENBIT -
(cache[j].allistrue) ? GETSIGN(datum_l) : GETSIGN(cache[j].sign) sizebitvec((cache[j].allistrue) ? GETSIGN(datum_l) :
); GETSIGN(cache[j].sign));
} }
else else
size_alpha = hemdistsign(cache[j].sign, GETSIGN(datum_l)); size_alpha = hemdistsign(cache[j].sign, GETSIGN(datum_l));
@ -890,9 +890,9 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
if (ISALLTRUE(datum_r) && cache[j].allistrue) if (ISALLTRUE(datum_r) && cache[j].allistrue)
size_beta = 0; size_beta = 0;
else else
size_beta = SIGLENBIT - sizebitvec( size_beta = SIGLENBIT -
(cache[j].allistrue) ? GETSIGN(datum_r) : GETSIGN(cache[j].sign) sizebitvec((cache[j].allistrue) ? GETSIGN(datum_r) :
); GETSIGN(cache[j].sign));
} }
else else
size_beta = hemdistsign(cache[j].sign, GETSIGN(datum_r)); size_beta = hemdistsign(cache[j].sign, GETSIGN(datum_r));

View File

@ -975,14 +975,12 @@ show_trgm(PG_FUNCTION_ARGS)
d[i] = PointerGetDatum(item); d[i] = PointerGetDatum(item);
} }
a = construct_array( a = construct_array(d,
d,
ARRNELEM(trg), ARRNELEM(trg),
TEXTOID, TEXTOID,
-1, -1,
false, false,
'i' 'i');
);
for (i = 0; i < ARRNELEM(trg); i++) for (i = 0; i < ARRNELEM(trg); i++)
pfree(DatumGetPointer(d[i])); pfree(DatumGetPointer(d[i]));

View File

@ -557,8 +557,9 @@ seg_contained(PG_FUNCTION_ARGS)
Datum Datum
seg_same(PG_FUNCTION_ARGS) seg_same(PG_FUNCTION_ARGS)
{ {
int cmp = DatumGetInt32( int cmp = DatumGetInt32(DirectFunctionCall2(seg_cmp,
DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
PG_RETURN_BOOL(cmp == 0); PG_RETURN_BOOL(cmp == 0);
} }
@ -845,8 +846,9 @@ seg_cmp(PG_FUNCTION_ARGS)
Datum Datum
seg_lt(PG_FUNCTION_ARGS) seg_lt(PG_FUNCTION_ARGS)
{ {
int cmp = DatumGetInt32( int cmp = DatumGetInt32(DirectFunctionCall2(seg_cmp,
DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
PG_RETURN_BOOL(cmp < 0); PG_RETURN_BOOL(cmp < 0);
} }
@ -854,8 +856,9 @@ seg_lt(PG_FUNCTION_ARGS)
Datum Datum
seg_le(PG_FUNCTION_ARGS) seg_le(PG_FUNCTION_ARGS)
{ {
int cmp = DatumGetInt32( int cmp = DatumGetInt32(DirectFunctionCall2(seg_cmp,
DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
PG_RETURN_BOOL(cmp <= 0); PG_RETURN_BOOL(cmp <= 0);
} }
@ -863,8 +866,9 @@ seg_le(PG_FUNCTION_ARGS)
Datum Datum
seg_gt(PG_FUNCTION_ARGS) seg_gt(PG_FUNCTION_ARGS)
{ {
int cmp = DatumGetInt32( int cmp = DatumGetInt32(DirectFunctionCall2(seg_cmp,
DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
PG_RETURN_BOOL(cmp > 0); PG_RETURN_BOOL(cmp > 0);
} }
@ -872,8 +876,9 @@ seg_gt(PG_FUNCTION_ARGS)
Datum Datum
seg_ge(PG_FUNCTION_ARGS) seg_ge(PG_FUNCTION_ARGS)
{ {
int cmp = DatumGetInt32( int cmp = DatumGetInt32(DirectFunctionCall2(seg_cmp,
DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
PG_RETURN_BOOL(cmp >= 0); PG_RETURN_BOOL(cmp >= 0);
} }
@ -882,8 +887,9 @@ seg_ge(PG_FUNCTION_ARGS)
Datum Datum
seg_different(PG_FUNCTION_ARGS) seg_different(PG_FUNCTION_ARGS)
{ {
int cmp = DatumGetInt32( int cmp = DatumGetInt32(DirectFunctionCall2(seg_cmp,
DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
PG_RETURN_BOOL(cmp != 0); PG_RETURN_BOOL(cmp != 0);
} }

View File

@ -419,9 +419,7 @@ pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
appendStringInfoString(ctx->out, "table "); appendStringInfoString(ctx->out, "table ");
appendStringInfoString(ctx->out, appendStringInfoString(ctx->out,
quote_qualified_identifier( quote_qualified_identifier(get_namespace_name(get_rel_namespace(RelationGetRelid(relation))),
get_namespace_name(
get_rel_namespace(RelationGetRelid(relation))),
class_form->relrewrite ? class_form->relrewrite ?
get_rel_name(class_form->relrewrite) : get_rel_name(class_form->relrewrite) :
NameStr(class_form->relname))); NameStr(class_form->relname)));

View File

@ -94,8 +94,7 @@ directBoolConsistentFn(GinScanKey key)
static GinTernaryValue static GinTernaryValue
directTriConsistentFn(GinScanKey key) directTriConsistentFn(GinScanKey key)
{ {
return DatumGetGinTernaryValue(FunctionCall7Coll( return DatumGetGinTernaryValue(FunctionCall7Coll(key->triConsistentFmgrInfo,
key->triConsistentFmgrInfo,
key->collation, key->collation,
PointerGetDatum(key->entryRes), PointerGetDatum(key->entryRes),
UInt16GetDatum(key->strategy), UInt16GetDatum(key->strategy),
@ -116,8 +115,7 @@ shimBoolConsistentFn(GinScanKey key)
{ {
GinTernaryValue result; GinTernaryValue result;
result = DatumGetGinTernaryValue(FunctionCall7Coll( result = DatumGetGinTernaryValue(FunctionCall7Coll(key->triConsistentFmgrInfo,
key->triConsistentFmgrInfo,
key->collation, key->collation,
PointerGetDatum(key->entryRes), PointerGetDatum(key->entryRes),
UInt16GetDatum(key->strategy), UInt16GetDatum(key->strategy),

View File

@ -1377,8 +1377,7 @@ gist_point_consistent(PG_FUNCTION_ARGS)
{ {
POLYGON *query = PG_GETARG_POLYGON_P(1); POLYGON *query = PG_GETARG_POLYGON_P(1);
result = DatumGetBool(DirectFunctionCall5( result = DatumGetBool(DirectFunctionCall5(gist_poly_consistent,
gist_poly_consistent,
PointerGetDatum(entry), PointerGetDatum(entry),
PolygonPGetDatum(query), PolygonPGetDatum(query),
Int16GetDatum(RTOverlapStrategyNumber), Int16GetDatum(RTOverlapStrategyNumber),
@ -1394,8 +1393,7 @@ gist_point_consistent(PG_FUNCTION_ARGS)
Assert(box->high.x == box->low.x Assert(box->high.x == box->low.x
&& box->high.y == box->low.y); && box->high.y == box->low.y);
result = DatumGetBool(DirectFunctionCall2( result = DatumGetBool(DirectFunctionCall2(poly_contain_pt,
poly_contain_pt,
PolygonPGetDatum(query), PolygonPGetDatum(query),
PointPGetDatum(&box->high))); PointPGetDatum(&box->high)));
*recheck = false; *recheck = false;
@ -1406,8 +1404,7 @@ gist_point_consistent(PG_FUNCTION_ARGS)
{ {
CIRCLE *query = PG_GETARG_CIRCLE_P(1); CIRCLE *query = PG_GETARG_CIRCLE_P(1);
result = DatumGetBool(DirectFunctionCall5( result = DatumGetBool(DirectFunctionCall5(gist_circle_consistent,
gist_circle_consistent,
PointerGetDatum(entry), PointerGetDatum(entry),
CirclePGetDatum(query), CirclePGetDatum(query),
Int16GetDatum(RTOverlapStrategyNumber), Int16GetDatum(RTOverlapStrategyNumber),
@ -1423,8 +1420,7 @@ gist_point_consistent(PG_FUNCTION_ARGS)
Assert(box->high.x == box->low.x Assert(box->high.x == box->low.x
&& box->high.y == box->low.y); && box->high.y == box->low.y);
result = DatumGetBool(DirectFunctionCall2( result = DatumGetBool(DirectFunctionCall2(circle_contain_pt,
circle_contain_pt,
CirclePGetDatum(query), CirclePGetDatum(query),
PointPGetDatum(&box->high))); PointPGetDatum(&box->high)));
*recheck = false; *recheck = false;

View File

@ -4282,8 +4282,7 @@ l3:
/* if the xmax changed in the meantime, start over */ /* if the xmax changed in the meantime, start over */
if (xmax_infomask_changed(tuple->t_data->t_infomask, infomask) || if (xmax_infomask_changed(tuple->t_data->t_infomask, infomask) ||
!TransactionIdEquals( !TransactionIdEquals(HeapTupleHeaderGetRawXmax(tuple->t_data),
HeapTupleHeaderGetRawXmax(tuple->t_data),
xwait)) xwait))
goto l3; goto l3;
/* otherwise, we're good */ /* otherwise, we're good */

View File

@ -295,9 +295,9 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
xact_desc_relations(buf, "rels", parsed.nrels, parsed.xnodes); xact_desc_relations(buf, "rels", parsed.nrels, parsed.xnodes);
xact_desc_subxacts(buf, parsed.nsubxacts, parsed.subxacts); xact_desc_subxacts(buf, parsed.nsubxacts, parsed.subxacts);
standby_desc_invalidations( standby_desc_invalidations(buf, parsed.nmsgs, parsed.msgs, parsed.dbId,
buf, parsed.nmsgs, parsed.msgs, parsed.dbId, parsed.tsId, parsed.tsId,
XactCompletionRelcacheInitFileInval(parsed.xinfo)); XactCompletionRelcacheInitFileInval(parsed.xinfo));
if (XactCompletionForceSyncCommit(parsed.xinfo)) if (XactCompletionForceSyncCommit(parsed.xinfo))
appendStringInfoString(buf, "; sync"); appendStringInfoString(buf, "; sync");
@ -344,9 +344,8 @@ xact_desc_prepare(StringInfo buf, uint8 info, xl_xact_prepare *xlrec)
parsed.abortnodes); parsed.abortnodes);
xact_desc_subxacts(buf, parsed.nsubxacts, parsed.subxacts); xact_desc_subxacts(buf, parsed.nsubxacts, parsed.subxacts);
standby_desc_invalidations( standby_desc_invalidations(buf, parsed.nmsgs, parsed.msgs, parsed.dbId,
buf, parsed.nmsgs, parsed.msgs, parsed.dbId, parsed.tsId, parsed.tsId, xlrec->initfileinval);
xlrec->initfileinval);
} }
static void static void

View File

@ -650,8 +650,7 @@ spgInnerTest(SpGistScanOpaque so, SpGistSearchItem *item,
{ {
/* collect node pointers */ /* collect node pointers */
SpGistNodeTuple node; SpGistNodeTuple node;
SpGistNodeTuple *nodes = (SpGistNodeTuple *) palloc( SpGistNodeTuple *nodes = (SpGistNodeTuple *) palloc(sizeof(SpGistNodeTuple) * nNodes);
sizeof(SpGistNodeTuple) * nNodes);
SGITITERATE(innerTuple, i, node) SGITITERATE(innerTuple, i, node)
{ {

View File

@ -5779,22 +5779,19 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
* bits set on changes made by transactions that haven't yet * bits set on changes made by transactions that haven't yet
* recovered. It's unlikely but it's good to be safe. * recovered. It's unlikely but it's good to be safe.
*/ */
TransactionIdAsyncCommitTree( TransactionIdAsyncCommitTree(xid, parsed->nsubxacts, parsed->subxacts, lsn);
xid, parsed->nsubxacts, parsed->subxacts, lsn);
/* /*
* We must mark clog before we update the ProcArray. * We must mark clog before we update the ProcArray.
*/ */
ExpireTreeKnownAssignedTransactionIds( ExpireTreeKnownAssignedTransactionIds(xid, parsed->nsubxacts, parsed->subxacts, max_xid);
xid, parsed->nsubxacts, parsed->subxacts, max_xid);
/* /*
* Send any cache invalidations attached to the commit. We must * Send any cache invalidations attached to the commit. We must
* maintain the same order of invalidation then release locks as * maintain the same order of invalidation then release locks as
* occurs in CommitTransaction(). * occurs in CommitTransaction().
*/ */
ProcessCommittedInvalidationMessages( ProcessCommittedInvalidationMessages(parsed->msgs, parsed->nmsgs,
parsed->msgs, parsed->nmsgs,
XactCompletionRelcacheInitFileInval(parsed->xinfo), XactCompletionRelcacheInitFileInval(parsed->xinfo),
parsed->dbId, parsed->tsId); parsed->dbId, parsed->tsId);
@ -5908,8 +5905,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid)
/* /*
* We must update the ProcArray after we have marked clog. * We must update the ProcArray after we have marked clog.
*/ */
ExpireTreeKnownAssignedTransactionIds( ExpireTreeKnownAssignedTransactionIds(xid, parsed->nsubxacts, parsed->subxacts, max_xid);
xid, parsed->nsubxacts, parsed->subxacts, max_xid);
/* /*
* There are no invalidation messages to send or undo. * There are no invalidation messages to send or undo.

View File

@ -2256,8 +2256,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
else else
{ {
/* otherwise make a one-element array of the value */ /* otherwise make a one-element array of the value */
missingval = PointerGetDatum( missingval = PointerGetDatum(construct_array(&missingval,
construct_array(&missingval,
1, 1,
defAttStruct->atttypid, defAttStruct->atttypid,
defAttStruct->attlen, defAttStruct->attlen,

View File

@ -2163,8 +2163,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS)
/* command tag */ /* command tag */
values[i++] = CStringGetTextDatum(CreateCommandTag(cmd->parsetree)); values[i++] = CStringGetTextDatum(CreateCommandTag(cmd->parsetree));
/* object_type */ /* object_type */
values[i++] = CStringGetTextDatum(stringify_adefprivs_objtype( values[i++] = CStringGetTextDatum(stringify_adefprivs_objtype(cmd->d.defprivs.objtype));
cmd->d.defprivs.objtype));
/* schema */ /* schema */
nulls[i++] = true; nulls[i++] = true;
/* identity */ /* identity */
@ -2186,8 +2185,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS)
values[i++] = CStringGetTextDatum(cmd->d.grant.istmt->is_grant ? values[i++] = CStringGetTextDatum(cmd->d.grant.istmt->is_grant ?
"GRANT" : "REVOKE"); "GRANT" : "REVOKE");
/* object_type */ /* object_type */
values[i++] = CStringGetTextDatum(stringify_grant_objtype( values[i++] = CStringGetTextDatum(stringify_grant_objtype(cmd->d.grant.istmt->objtype));
cmd->d.grant.istmt->objtype));
/* schema */ /* schema */
nulls[i++] = true; nulls[i++] = true;
/* identity */ /* identity */

View File

@ -11481,8 +11481,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
attTup->attbyval, attTup->attbyval,
attTup->attalign, attTup->attalign,
&isNull); &isNull);
missingval = PointerGetDatum( missingval = PointerGetDatum(construct_array(&missingval,
construct_array(&missingval,
1, 1,
targettype, targettype,
tform->typlen, tform->typlen,

View File

@ -3816,8 +3816,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
return; return;
value = argvalue[0]; value = argvalue[0];
*op->resvalue = PointerGetDatum( *op->resvalue = PointerGetDatum(xmltotext_with_xmloption(DatumGetXmlP(value),
xmltotext_with_xmloption(DatumGetXmlP(value),
xexpr->xmloption)); xexpr->xmloption));
*op->resnull = false; *op->resnull = false;
} }
@ -4174,8 +4173,7 @@ ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup
* that the agg's input type is binary-compatible with its transtype, so * that the agg's input type is binary-compatible with its transtype, so
* straight copy here is OK.) * straight copy here is OK.)
*/ */
oldContext = MemoryContextSwitchTo( oldContext = MemoryContextSwitchTo(aggstate->curaggcontext->ecxt_per_tuple_memory);
aggstate->curaggcontext->ecxt_per_tuple_memory);
pergroup->transValue = datumCopy(fcinfo->args[1].value, pergroup->transValue = datumCopy(fcinfo->args[1].value,
pertrans->transtypeByVal, pertrans->transtypeByVal,
pertrans->transtypeLen); pertrans->transtypeLen);

View File

@ -475,8 +475,7 @@ initialize_aggregate(AggState *aggstate, AggStatePerTrans pertrans,
{ {
MemoryContext oldContext; MemoryContext oldContext;
oldContext = MemoryContextSwitchTo( oldContext = MemoryContextSwitchTo(aggstate->curaggcontext->ecxt_per_tuple_memory);
aggstate->curaggcontext->ecxt_per_tuple_memory);
pergroupstate->transValue = datumCopy(pertrans->initValue, pergroupstate->transValue = datumCopy(pertrans->initValue,
pertrans->transtypeByVal, pertrans->transtypeByVal,
pertrans->transtypeLen); pertrans->transtypeLen);
@ -582,8 +581,7 @@ advance_transition_function(AggState *aggstate,
* We must copy the datum into aggcontext if it is pass-by-ref. We * We must copy the datum into aggcontext if it is pass-by-ref. We
* do not need to pfree the old transValue, since it's NULL. * do not need to pfree the old transValue, since it's NULL.
*/ */
oldContext = MemoryContextSwitchTo( oldContext = MemoryContextSwitchTo(aggstate->curaggcontext->ecxt_per_tuple_memory);
aggstate->curaggcontext->ecxt_per_tuple_memory);
pergroupstate->transValue = datumCopy(fcinfo->args[1].value, pergroupstate->transValue = datumCopy(fcinfo->args[1].value,
pertrans->transtypeByVal, pertrans->transtypeByVal,
pertrans->transtypeLen); pertrans->transtypeLen);

View File

@ -188,8 +188,7 @@ static int pg_GSS_recvauth(Port *port);
*/ */
#ifdef ENABLE_SSPI #ifdef ENABLE_SSPI
typedef SECURITY_STATUS typedef SECURITY_STATUS
(WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) ( (WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) (PCtxtHandle, void **);
PCtxtHandle, void **);
static int pg_SSPI_recvauth(Port *port); static int pg_SSPI_recvauth(Port *port);
static int pg_SSPI_make_upn(char *accountname, static int pg_SSPI_make_upn(char *accountname,
size_t accountnamesize, size_t accountnamesize,
@ -1147,8 +1146,7 @@ pg_GSS_recvauth(Port *port)
elog(DEBUG4, "processing received GSS token of length %u", elog(DEBUG4, "processing received GSS token of length %u",
(unsigned int) gbuf.length); (unsigned int) gbuf.length);
maj_stat = gss_accept_sec_context( maj_stat = gss_accept_sec_context(&min_stat,
&min_stat,
&port->gss->ctx, &port->gss->ctx,
port->gss->cred, port->gss->cred,
&gbuf, &gbuf,

View File

@ -1538,8 +1538,7 @@ match_unsorted_outer(PlannerInfo *root,
if (save_jointype == JOIN_UNIQUE_INNER) if (save_jointype == JOIN_UNIQUE_INNER)
return; return;
inner_cheapest_total = get_cheapest_parallel_safe_total_inner( inner_cheapest_total = get_cheapest_parallel_safe_total_inner(innerrel->pathlist);
innerrel->pathlist);
} }
if (inner_cheapest_total) if (inner_cheapest_total)

View File

@ -5110,13 +5110,11 @@ static void
bitmap_subplan_mark_shared(Plan *plan) bitmap_subplan_mark_shared(Plan *plan)
{ {
if (IsA(plan, BitmapAnd)) if (IsA(plan, BitmapAnd))
bitmap_subplan_mark_shared( bitmap_subplan_mark_shared(linitial(((BitmapAnd *) plan)->bitmapplans));
linitial(((BitmapAnd *) plan)->bitmapplans));
else if (IsA(plan, BitmapOr)) else if (IsA(plan, BitmapOr))
{ {
((BitmapOr *) plan)->isshared = true; ((BitmapOr *) plan)->isshared = true;
bitmap_subplan_mark_shared( bitmap_subplan_mark_shared(linitial(((BitmapOr *) plan)->bitmapplans));
linitial(((BitmapOr *) plan)->bitmapplans));
} }
else if (IsA(plan, BitmapIndexScan)) else if (IsA(plan, BitmapIndexScan))
((BitmapIndexScan *) plan)->isshared = true; ((BitmapIndexScan *) plan)->isshared = true;

View File

@ -4571,14 +4571,12 @@ PgstatCollectorMain(int argc, char *argv[])
break; break;
case PGSTAT_MTYPE_RESETSHAREDCOUNTER: case PGSTAT_MTYPE_RESETSHAREDCOUNTER:
pgstat_recv_resetsharedcounter( pgstat_recv_resetsharedcounter(&msg.msg_resetsharedcounter,
&msg.msg_resetsharedcounter,
len); len);
break; break;
case PGSTAT_MTYPE_RESETSINGLECOUNTER: case PGSTAT_MTYPE_RESETSINGLECOUNTER:
pgstat_recv_resetsinglecounter( pgstat_recv_resetsinglecounter(&msg.msg_resetsinglecounter,
&msg.msg_resetsinglecounter,
len); len);
break; break;
@ -4611,8 +4609,7 @@ PgstatCollectorMain(int argc, char *argv[])
break; break;
case PGSTAT_MTYPE_RECOVERYCONFLICT: case PGSTAT_MTYPE_RECOVERYCONFLICT:
pgstat_recv_recoveryconflict( pgstat_recv_recoveryconflict(&msg.msg_recoveryconflict,
&msg.msg_recoveryconflict,
len); len);
break; break;
@ -4625,8 +4622,7 @@ PgstatCollectorMain(int argc, char *argv[])
break; break;
case PGSTAT_MTYPE_CHECKSUMFAILURE: case PGSTAT_MTYPE_CHECKSUMFAILURE:
pgstat_recv_checksum_failure( pgstat_recv_checksum_failure(&msg.msg_checksumfailure,
&msg.msg_checksumfailure,
len); len);
break; break;

View File

@ -90,8 +90,7 @@ LogicalOutputWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xi
false)); false));
/* ick, but cstring_to_text_with_len works for bytea perfectly fine */ /* ick, but cstring_to_text_with_len works for bytea perfectly fine */
values[2] = PointerGetDatum( values[2] = PointerGetDatum(cstring_to_text_with_len(ctx->out->data, ctx->out->len));
cstring_to_text_with_len(ctx->out->data, ctx->out->len));
tuplestore_putvalues(p->tupstore, p->tupdesc, values, nulls); tuplestore_putvalues(p->tupstore, p->tupdesc, values, nulls);
p->returned_rows++; p->returned_rows++;

View File

@ -3415,8 +3415,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn,
cchange = dlist_container(ReorderBufferChange, node, it.cur); cchange = dlist_container(ReorderBufferChange, node, it.cur);
ctup = cchange->data.tp.newtuple; ctup = cchange->data.tp.newtuple;
chunk = DatumGetPointer( chunk = DatumGetPointer(fastgetattr(&ctup->tuple, 3, toast_desc, &isnull));
fastgetattr(&ctup->tuple, 3, toast_desc, &isnull));
Assert(!isnull); Assert(!isnull);
Assert(!VARATT_IS_EXTERNAL(chunk)); Assert(!VARATT_IS_EXTERNAL(chunk));

View File

@ -2558,8 +2558,7 @@ CreateCommandTag(Node *parsetree)
* When the column is renamed, the command tag is created from its * When the column is renamed, the command tag is created from its
* relation type * relation type
*/ */
tag = AlterObjectTypeCommandTag( tag = AlterObjectTypeCommandTag(((RenameStmt *) parsetree)->renameType == OBJECT_COLUMN ?
((RenameStmt *) parsetree)->renameType == OBJECT_COLUMN ?
((RenameStmt *) parsetree)->relationType : ((RenameStmt *) parsetree)->relationType :
((RenameStmt *) parsetree)->renameType); ((RenameStmt *) parsetree)->renameType);
break; break;

View File

@ -533,15 +533,11 @@ compileTheSubstitute(DictThesaurus *d)
} }
else else
{ {
lexized = (TSLexeme *) DatumGetPointer( lexized = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize),
FunctionCall4(
&(d->subdict->lexize),
PointerGetDatum(d->subdict->dictData), PointerGetDatum(d->subdict->dictData),
PointerGetDatum(inptr->lexeme), PointerGetDatum(inptr->lexeme),
Int32GetDatum(strlen(inptr->lexeme)), Int32GetDatum(strlen(inptr->lexeme)),
PointerGetDatum(NULL) PointerGetDatum(NULL)));
)
);
} }
if (lexized && lexized->lexeme) if (lexized && lexized->lexeme)

View File

@ -49,8 +49,7 @@ compareWORD(const void *a, const void *b)
{ {
int res; int res;
res = tsCompareString( res = tsCompareString(((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len,
((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len,
((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len, ((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len,
false); false);

View File

@ -204,13 +204,11 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
ld->dictState.isend = ld->dictState.getnext = false; ld->dictState.isend = ld->dictState.getnext = false;
ld->dictState.private_state = NULL; ld->dictState.private_state = NULL;
res = (TSLexeme *) DatumGetPointer(FunctionCall4( res = (TSLexeme *) DatumGetPointer(FunctionCall4(&(dict->lexize),
&(dict->lexize),
PointerGetDatum(dict->dictData), PointerGetDatum(dict->dictData),
PointerGetDatum(curValLemm), PointerGetDatum(curValLemm),
Int32GetDatum(curValLenLemm), Int32GetDatum(curValLenLemm),
PointerGetDatum(&ld->dictState) PointerGetDatum(&ld->dictState)));
));
if (ld->dictState.getnext) if (ld->dictState.getnext)
{ {
@ -293,13 +291,11 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
ld->dictState.isend = (curVal->type == 0) ? true : false; ld->dictState.isend = (curVal->type == 0) ? true : false;
ld->dictState.getnext = false; ld->dictState.getnext = false;
res = (TSLexeme *) DatumGetPointer(FunctionCall4( res = (TSLexeme *) DatumGetPointer(FunctionCall4(&(dict->lexize),
&(dict->lexize),
PointerGetDatum(dict->dictData), PointerGetDatum(dict->dictData),
PointerGetDatum(curVal->lemm), PointerGetDatum(curVal->lemm),
Int32GetDatum(curVal->lenlemm), Int32GetDatum(curVal->lenlemm),
PointerGetDatum(&ld->dictState) PointerGetDatum(&ld->dictState)));
));
if (ld->dictState.getnext) if (ld->dictState.getnext)
{ {

View File

@ -6217,8 +6217,7 @@ int8_to_char(PG_FUNCTION_ARGS)
if (IS_ROMAN(&Num)) if (IS_ROMAN(&Num))
{ {
/* Currently don't support int8 conversion to roman... */ /* Currently don't support int8 conversion to roman... */
numstr = orgnum = int_to_roman(DatumGetInt32( numstr = orgnum = int_to_roman(DatumGetInt32(DirectFunctionCall1(int84, Int64GetDatum(value))));
DirectFunctionCall1(int84, Int64GetDatum(value))));
} }
else if (IS_EEEE(&Num)) else if (IS_EEEE(&Num))
{ {

View File

@ -1501,8 +1501,7 @@ pg_stat_get_db_conflict_all(PG_FUNCTION_ARGS)
if ((dbentry = pgstat_fetch_stat_dbentry(dbid)) == NULL) if ((dbentry = pgstat_fetch_stat_dbentry(dbid)) == NULL)
result = 0; result = 0;
else else
result = (int64) ( result = (int64) (dbentry->n_conflict_tablespace +
dbentry->n_conflict_tablespace +
dbentry->n_conflict_lock + dbentry->n_conflict_lock +
dbentry->n_conflict_snapshot + dbentry->n_conflict_snapshot +
dbentry->n_conflict_bufferpin + dbentry->n_conflict_bufferpin +
@ -1973,6 +1972,5 @@ pg_stat_get_archiver(PG_FUNCTION_ARGS)
values[6] = TimestampTzGetDatum(archiver_stats->stat_reset_timestamp); values[6] = TimestampTzGetDatum(archiver_stats->stat_reset_timestamp);
/* Returns the record as Datum */ /* Returns the record as Datum */
PG_RETURN_DATUM(HeapTupleGetDatum( PG_RETURN_DATUM(HeapTupleGetDatum(heap_form_tuple(tupdesc, values, nulls)));
heap_form_tuple(tupdesc, values, nulls)));
} }

View File

@ -346,8 +346,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
* is RANGESTRAT_CONTAINS_ELEM. * is RANGESTRAT_CONTAINS_ELEM.
*/ */
if (strategy != RANGESTRAT_CONTAINS_ELEM) if (strategy != RANGESTRAT_CONTAINS_ELEM)
empty = RangeIsEmpty( empty = RangeIsEmpty(DatumGetRangeTypeP(in->scankeys[i].sk_argument));
DatumGetRangeTypeP(in->scankeys[i].sk_argument));
else else
empty = false; empty = false;

View File

@ -165,8 +165,7 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
* For an ordinary range, use subdiff function between upper * For an ordinary range, use subdiff function between upper
* and lower bound values. * and lower bound values.
*/ */
length = DatumGetFloat8(FunctionCall2Coll( length = DatumGetFloat8(FunctionCall2Coll(&typcache->rng_subdiff_finfo,
&typcache->rng_subdiff_finfo,
typcache->rng_collation, typcache->rng_collation,
upper.val, lower.val)); upper.val, lower.val));
} }
@ -246,8 +245,10 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
for (i = 0; i < num_hist; i++) for (i = 0; i < num_hist; i++)
{ {
bound_hist_values[i] = PointerGetDatum(range_serialize( bound_hist_values[i] = PointerGetDatum(range_serialize(typcache,
typcache, &lowers[pos], &uppers[pos], false)); &lowers[pos],
&uppers[pos],
false));
pos += delta; pos += delta;
posfrac += deltafrac; posfrac += deltafrac;
if (posfrac >= (num_hist - 1)) if (posfrac >= (num_hist - 1))

View File

@ -6453,8 +6453,7 @@ get_update_query_targetlist_def(Query *query, List *targetList,
{ {
cur_ma_sublink = (SubLink *) lfirst(next_ma_cell); cur_ma_sublink = (SubLink *) lfirst(next_ma_cell);
next_ma_cell = lnext(ma_sublinks, next_ma_cell); next_ma_cell = lnext(ma_sublinks, next_ma_cell);
remaining_ma_columns = count_nonjunk_tlist_entries( remaining_ma_columns = count_nonjunk_tlist_entries(((Query *) cur_ma_sublink->subselect)->targetList);
((Query *) cur_ma_sublink->subselect)->targetList);
Assert(((Param *) expr)->paramid == Assert(((Param *) expr)->paramid ==
((cur_ma_sublink->subLinkId << 16) | 1)); ((cur_ma_sublink->subLinkId << 16) | 1));
appendStringInfoChar(buf, '('); appendStringInfoChar(buf, '(');

View File

@ -5459,8 +5459,7 @@ generate_series_timestamp(PG_FUNCTION_ARGS)
timestamp_cmp_internal(result, fctx->finish) >= 0) timestamp_cmp_internal(result, fctx->finish) >= 0)
{ {
/* increment current in preparation for next iteration */ /* increment current in preparation for next iteration */
fctx->current = DatumGetTimestamp( fctx->current = DatumGetTimestamp(DirectFunctionCall2(timestamp_pl_interval,
DirectFunctionCall2(timestamp_pl_interval,
TimestampGetDatum(fctx->current), TimestampGetDatum(fctx->current),
PointerGetDatum(&fctx->step))); PointerGetDatum(&fctx->step)));
@ -5540,8 +5539,7 @@ generate_series_timestamptz(PG_FUNCTION_ARGS)
timestamp_cmp_internal(result, fctx->finish) >= 0) timestamp_cmp_internal(result, fctx->finish) >= 0)
{ {
/* increment current in preparation for next iteration */ /* increment current in preparation for next iteration */
fctx->current = DatumGetTimestampTz( fctx->current = DatumGetTimestampTz(DirectFunctionCall2(timestamptz_pl_interval,
DirectFunctionCall2(timestamptz_pl_interval,
TimestampTzGetDatum(fctx->current), TimestampTzGetDatum(fctx->current),
PointerGetDatum(&fctx->step))); PointerGetDatum(&fctx->step)));

View File

@ -704,9 +704,9 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
if (ISALLTRUE(datum_l) && cache[j].allistrue) if (ISALLTRUE(datum_l) && cache[j].allistrue)
size_alpha = 0; size_alpha = 0;
else else
size_alpha = SIGLENBIT - sizebitvec( size_alpha = SIGLENBIT - sizebitvec((cache[j].allistrue) ?
(cache[j].allistrue) ? GETSIGN(datum_l) : GETSIGN(cache[j].sign) GETSIGN(datum_l) :
); GETSIGN(cache[j].sign));
} }
else else
size_alpha = hemdistsign(cache[j].sign, GETSIGN(datum_l)); size_alpha = hemdistsign(cache[j].sign, GETSIGN(datum_l));
@ -716,9 +716,9 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
if (ISALLTRUE(datum_r) && cache[j].allistrue) if (ISALLTRUE(datum_r) && cache[j].allistrue)
size_beta = 0; size_beta = 0;
else else
size_beta = SIGLENBIT - sizebitvec( size_beta = SIGLENBIT - sizebitvec((cache[j].allistrue) ?
(cache[j].allistrue) ? GETSIGN(datum_r) : GETSIGN(cache[j].sign) GETSIGN(datum_r) :
); GETSIGN(cache[j].sign));
} }
else else
size_beta = hemdistsign(cache[j].sign, GETSIGN(datum_r)); size_beta = hemdistsign(cache[j].sign, GETSIGN(datum_r));

View File

@ -148,8 +148,7 @@ tsquery_phrase_distance(PG_FUNCTION_ARGS)
Datum Datum
tsquery_phrase(PG_FUNCTION_ARGS) tsquery_phrase(PG_FUNCTION_ARGS)
{ {
PG_RETURN_POINTER(DirectFunctionCall3( PG_RETURN_POINTER(DirectFunctionCall3(tsquery_phrase_distance,
tsquery_phrase_distance,
PG_GETARG_DATUM(0), PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1), PG_GETARG_DATUM(1),
Int32GetDatum(1))); Int32GetDatum(1)));
@ -353,11 +352,7 @@ tsq_mcontains(PG_FUNCTION_ARGS)
Datum Datum
tsq_mcontained(PG_FUNCTION_ARGS) tsq_mcontained(PG_FUNCTION_ARGS)
{ {
PG_RETURN_DATUM( PG_RETURN_DATUM(DirectFunctionCall2(tsq_mcontains,
DirectFunctionCall2(
tsq_mcontains,
PG_GETARG_DATUM(1), PG_GETARG_DATUM(1),
PG_GETARG_DATUM(0) PG_GETARG_DATUM(0)));
)
);
} }

View File

@ -666,9 +666,7 @@ tsvector_unnest(PG_FUNCTION_ARGS)
bool nulls[] = {false, false, false}; bool nulls[] = {false, false, false};
Datum values[3]; Datum values[3];
values[0] = PointerGetDatum( values[0] = PointerGetDatum(cstring_to_text_with_len(data + arrin[i].pos, arrin[i].len));
cstring_to_text_with_len(data + arrin[i].pos, arrin[i].len)
);
if (arrin[i].haspos) if (arrin[i].haspos)
{ {
@ -689,15 +687,14 @@ tsvector_unnest(PG_FUNCTION_ARGS)
{ {
positions[j] = Int16GetDatum(WEP_GETPOS(posv->pos[j])); positions[j] = Int16GetDatum(WEP_GETPOS(posv->pos[j]));
weight = 'D' - WEP_GETWEIGHT(posv->pos[j]); weight = 'D' - WEP_GETWEIGHT(posv->pos[j]);
weights[j] = PointerGetDatum( weights[j] = PointerGetDatum(cstring_to_text_with_len(&weight,
cstring_to_text_with_len(&weight, 1) 1));
);
} }
values[1] = PointerGetDatum( values[1] = PointerGetDatum(construct_array(positions, posv->npos,
construct_array(positions, posv->npos, INT2OID, 2, true, 's')); INT2OID, 2, true, 's'));
values[2] = PointerGetDatum( values[2] = PointerGetDatum(construct_array(weights, posv->npos,
construct_array(weights, posv->npos, TEXTOID, -1, false, 'i')); TEXTOID, -1, false, 'i'));
} }
else else
{ {
@ -730,9 +727,8 @@ tsvector_to_array(PG_FUNCTION_ARGS)
for (i = 0; i < tsin->size; i++) for (i = 0; i < tsin->size; i++)
{ {
elements[i] = PointerGetDatum( elements[i] = PointerGetDatum(cstring_to_text_with_len(STRPTR(tsin) + arrin[i].pos,
cstring_to_text_with_len(STRPTR(tsin) + arrin[i].pos, arrin[i].len) arrin[i].len));
);
} }
array = construct_array(elements, tsin->size, TEXTOID, -1, false, 'i'); array = construct_array(elements, tsin->size, TEXTOID, -1, false, 'i');

View File

@ -199,8 +199,7 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
values[16] = TransactionIdGetDatum(ControlFile->checkPointCopy.newestCommitTsXid); values[16] = TransactionIdGetDatum(ControlFile->checkPointCopy.newestCommitTsXid);
nulls[16] = false; nulls[16] = false;
values[17] = TimestampTzGetDatum( values[17] = TimestampTzGetDatum(time_t_to_timestamptz(ControlFile->checkPointCopy.time));
time_t_to_timestamptz(ControlFile->checkPointCopy.time));
nulls[17] = false; nulls[17] = false;
htup = heap_form_tuple(tupdesc, values, nulls); htup = heap_form_tuple(tupdesc, values, nulls);

View File

@ -57,8 +57,8 @@ get_tablespace_paths(void)
res = executeQueryOrDie(conn, "%s", query); res = executeQueryOrDie(conn, "%s", query);
if ((os_info.num_old_tablespaces = PQntuples(res)) != 0) if ((os_info.num_old_tablespaces = PQntuples(res)) != 0)
os_info.old_tablespaces = (char **) pg_malloc( os_info.old_tablespaces =
os_info.num_old_tablespaces * sizeof(char *)); (char **) pg_malloc(os_info.num_old_tablespaces * sizeof(char *));
else else
os_info.old_tablespaces = NULL; os_info.old_tablespaces = NULL;
@ -68,8 +68,7 @@ get_tablespace_paths(void)
{ {
struct stat statBuf; struct stat statBuf;
os_info.old_tablespaces[tblnum] = pg_strdup( os_info.old_tablespaces[tblnum] = pg_strdup(PQgetvalue(res, tblnum, i_spclocation));
PQgetvalue(res, tblnum, i_spclocation));
/* /*
* Check that the tablespace path exists and is a directory. * Check that the tablespace path exists and is a directory.

View File

@ -663,8 +663,7 @@ helpSQL(const char *topic, unsigned short int pager)
void void
print_copyright(void) print_copyright(void)
{ {
puts( puts("PostgreSQL Database Management System\n"
"PostgreSQL Database Management System\n"
"(formerly known as Postgres, then as Postgres95)\n\n" "(formerly known as Postgres, then as Postgres95)\n\n"
"Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group\n\n" "Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group\n\n"
"Portions Copyright (c) 1994, The Regents of the University of California\n\n" "Portions Copyright (c) 1994, The Regents of the University of California\n\n"
@ -681,6 +680,5 @@ print_copyright(void)
"INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\n" "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\n"
"AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\n" "AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\n"
"ON AN \"AS IS\" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO\n" "ON AN \"AS IS\" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO\n"
"PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n" "PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n");
);
} }

View File

@ -2301,10 +2301,7 @@ PQconnectPoll(PGconn *conn)
default: default:
appendPQExpBufferStr(&conn->errorMessage, appendPQExpBufferStr(&conn->errorMessage,
libpq_gettext( libpq_gettext("invalid connection state, probably indicative of memory corruption\n"));
"invalid connection state, "
"probably indicative of memory corruption\n"
));
goto error_return; goto error_return;
} }
@ -3217,9 +3214,7 @@ keep_going: /* We will come back to here until there is
if (!(beresp == 'R' || beresp == 'E')) if (!(beresp == 'R' || beresp == 'E'))
{ {
appendPQExpBuffer(&conn->errorMessage, appendPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("expected authentication request from server, but received %c\n"),
"expected authentication request from "
"server, but received %c\n"),
beresp); beresp);
goto error_return; goto error_return;
} }
@ -3250,9 +3245,7 @@ keep_going: /* We will come back to here until there is
if (beresp == 'R' && (msgLength < 8 || msgLength > 2000)) if (beresp == 'R' && (msgLength < 8 || msgLength > 2000))
{ {
appendPQExpBuffer(&conn->errorMessage, appendPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("expected authentication request from server, but received %c\n"),
"expected authentication request from "
"server, but received %c\n"),
beresp); beresp);
goto error_return; goto error_return;
} }
@ -4637,8 +4630,9 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
p = strchr(url + strlen(LDAP_URL), '/'); p = strchr(url + strlen(LDAP_URL), '/');
if (p == NULL || *(p + 1) == '\0' || *(p + 1) == '?') if (p == NULL || *(p + 1) == '\0' || *(p + 1) == '?')
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"invalid LDAP URL \"%s\": missing distinguished name\n"), purl); libpq_gettext("invalid LDAP URL \"%s\": missing distinguished name\n"),
purl);
free(url); free(url);
return 3; return 3;
} }
@ -4648,8 +4642,9 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
/* attribute */ /* attribute */
if ((p = strchr(dn, '?')) == NULL || *(p + 1) == '\0' || *(p + 1) == '?') if ((p = strchr(dn, '?')) == NULL || *(p + 1) == '\0' || *(p + 1) == '?')
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"invalid LDAP URL \"%s\": must have exactly one attribute\n"), purl); libpq_gettext("invalid LDAP URL \"%s\": must have exactly one attribute\n"),
purl);
free(url); free(url);
return 3; return 3;
} }
@ -4690,8 +4685,9 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
lport = strtol(portstr, &endptr, 10); lport = strtol(portstr, &endptr, 10);
if (*portstr == '\0' || *endptr != '\0' || errno || lport < 0 || lport > 65535) if (*portstr == '\0' || *endptr != '\0' || errno || lport < 0 || lport > 65535)
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"invalid LDAP URL \"%s\": invalid port number\n"), purl); libpq_gettext("invalid LDAP URL \"%s\": invalid port number\n"),
purl);
free(url); free(url);
return 3; return 3;
} }
@ -4701,8 +4697,9 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
/* Allow only one attribute */ /* Allow only one attribute */
if (strchr(attrs[0], ',') != NULL) if (strchr(attrs[0], ',') != NULL)
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"invalid LDAP URL \"%s\": must have exactly one attribute\n"), purl); libpq_gettext("invalid LDAP URL \"%s\": must have exactly one attribute\n"),
purl);
free(url); free(url);
return 3; return 3;
} }
@ -4900,8 +4897,8 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
} }
else if (ld_is_nl_cr(*p)) else if (ld_is_nl_cr(*p))
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"missing \"=\" after \"%s\" in connection info string\n"), libpq_gettext("missing \"=\" after \"%s\" in connection info string\n"),
optname); optname);
free(result); free(result);
return 3; return 3;
@ -4919,8 +4916,8 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
} }
else if (!ld_is_sp_tab(*p)) else if (!ld_is_sp_tab(*p))
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"missing \"=\" after \"%s\" in connection info string\n"), libpq_gettext("missing \"=\" after \"%s\" in connection info string\n"),
optname); optname);
free(result); free(result);
return 3; return 3;
@ -5008,8 +5005,8 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
if (state == 5 || state == 6) if (state == 5 || state == 6)
{ {
printfPQExpBuffer(errorMessage, libpq_gettext( printfPQExpBuffer(errorMessage,
"unterminated quoted string in connection info string\n")); libpq_gettext("unterminated quoted string in connection info string\n"));
return 3; return 3;
} }

View File

@ -802,8 +802,7 @@ retry4:
*/ */
definitelyEOF: definitelyEOF:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("server closed the connection unexpectedly\n"
"server closed the connection unexpectedly\n"
"\tThis probably means the server terminated abnormally\n" "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n")); "\tbefore or while processing the request.\n"));

View File

@ -84,10 +84,7 @@ pqSetenvPoll(PGconn *conn)
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("invalid setenv state %c, probably indicative of memory corruption\n"),
"invalid setenv state %c, "
"probably indicative of memory corruption\n"
),
conn->setenv_state); conn->setenv_state);
goto error_return; goto error_return;
} }
@ -626,8 +623,7 @@ pqParseInput2(PGconn *conn)
*/ */
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("unexpected response from server; first received character was \"%c\"\n"),
"unexpected response from server; first received character was \"%c\"\n"),
id); id);
/* build an error result holding the error message */ /* build an error result holding the error message */
pqSaveErrorResult(conn); pqSaveErrorResult(conn);

View File

@ -405,8 +405,7 @@ pqParseInput3(PGconn *conn)
break; break;
default: default:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("unexpected response from server; first received character was \"%c\"\n"),
"unexpected response from server; first received character was \"%c\"\n"),
id); id);
/* build an error result holding the error message */ /* build an error result holding the error message */
pqSaveErrorResult(conn); pqSaveErrorResult(conn);
@ -447,8 +446,7 @@ static void
handleSyncLoss(PGconn *conn, char id, int msgLength) handleSyncLoss(PGconn *conn, char id, int msgLength)
{ {
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("lost synchronization with server: got message type \"%c\", length %d\n"),
"lost synchronization with server: got message type \"%c\", length %d\n"),
id, msgLength); id, msgLength);
/* build an error result holding the error message */ /* build an error result holding the error message */
pqSaveErrorResult(conn); pqSaveErrorResult(conn);

View File

@ -206,8 +206,7 @@ rloop:
if (result_errno == EPIPE || if (result_errno == EPIPE ||
result_errno == ECONNRESET) result_errno == ECONNRESET)
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("server closed the connection unexpectedly\n"
"server closed the connection unexpectedly\n"
"\tThis probably means the server terminated abnormally\n" "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n")); "\tbefore or while processing the request.\n"));
else else
@ -314,8 +313,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len)
result_errno = SOCK_ERRNO; result_errno = SOCK_ERRNO;
if (result_errno == EPIPE || result_errno == ECONNRESET) if (result_errno == EPIPE || result_errno == ECONNRESET)
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("server closed the connection unexpectedly\n"
"server closed the connection unexpectedly\n"
"\tThis probably means the server terminated abnormally\n" "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n")); "\tbefore or while processing the request.\n"));
else else
@ -578,10 +576,8 @@ pgtls_verify_peer_name_matches_certificate_guts(PGconn *conn,
if (cn_index >= 0) if (cn_index >= 0)
{ {
(*names_examined)++; (*names_examined)++;
rc = openssl_verify_peer_name_matches_certificate_name( rc = openssl_verify_peer_name_matches_certificate_name(conn,
conn, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subject_name, cn_index)),
X509_NAME_ENTRY_get_data(
X509_NAME_get_entry(subject_name, cn_index)),
first_name); first_name);
} }
} }

View File

@ -264,8 +264,7 @@ pqsecure_raw_read(PGconn *conn, void *ptr, size_t len)
#ifdef ECONNRESET #ifdef ECONNRESET
case ECONNRESET: case ECONNRESET:
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("server closed the connection unexpectedly\n"
"server closed the connection unexpectedly\n"
"\tThis probably means the server terminated abnormally\n" "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n")); "\tbefore or while processing the request.\n"));
break; break;
@ -381,8 +380,7 @@ retry_masked:
case ECONNRESET: case ECONNRESET:
#endif #endif
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext( libpq_gettext("server closed the connection unexpectedly\n"
"server closed the connection unexpectedly\n"
"\tThis probably means the server terminated abnormally\n" "\tThis probably means the server terminated abnormally\n"
"\tbefore or while processing the request.\n")); "\tbefore or while processing the request.\n"));
break; break;

View File

@ -291,8 +291,7 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen)
if (!dlls[i].loaded) if (!dlls[i].loaded)
{ {
dlls[i].loaded = 1; /* Only load once */ dlls[i].loaded = 1; /* Only load once */
dlls[i].handle = (void *) LoadLibraryEx( dlls[i].handle = (void *) LoadLibraryEx(dlls[i].dll_name,
dlls[i].dll_name,
0, 0,
LOAD_LIBRARY_AS_DATAFILE); LOAD_LIBRARY_AS_DATAFILE);
} }
@ -304,13 +303,11 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen)
| FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_IGNORE_INSERTS
| (dlls[i].handle ? FORMAT_MESSAGE_FROM_HMODULE : 0); | (dlls[i].handle ? FORMAT_MESSAGE_FROM_HMODULE : 0);
success = 0 != FormatMessage( success = 0 != FormatMessage(flags,
flags,
dlls[i].handle, err, dlls[i].handle, err,
MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
strerrbuf, buflen - 64, strerrbuf, buflen - 64,
0 0);
);
} }
if (!success) if (!success)

View File

@ -1631,11 +1631,8 @@ plperl_trigger_build_args(FunctionCallInfo fcinfo)
tdata = (TriggerData *) fcinfo->context; tdata = (TriggerData *) fcinfo->context;
tupdesc = tdata->tg_relation->rd_att; tupdesc = tdata->tg_relation->rd_att;
relid = DatumGetCString( relid = DatumGetCString(DirectFunctionCall1(oidout,
DirectFunctionCall1(oidout, ObjectIdGetDatum(tdata->tg_relation->rd_id)));
ObjectIdGetDatum(tdata->tg_relation->rd_id)
)
);
hv_store_string(hv, "name", cstr2sv(tdata->tg_trigger->tgname)); hv_store_string(hv, "name", cstr2sv(tdata->tg_trigger->tgname));
hv_store_string(hv, "relid", cstr2sv(relid)); hv_store_string(hv, "relid", cstr2sv(relid));

View File

@ -297,12 +297,10 @@ PLy_traceback(PyObject *e, PyObject *v, PyObject *tb,
plain_lineno = PyInt_AsLong(lineno); plain_lineno = PyInt_AsLong(lineno);
if (proname == NULL) if (proname == NULL)
appendStringInfo( appendStringInfo(&tbstr, "\n PL/Python anonymous code block, line %ld, in %s",
&tbstr, "\n PL/Python anonymous code block, line %ld, in %s",
plain_lineno - 1, fname); plain_lineno - 1, fname);
else else
appendStringInfo( appendStringInfo(&tbstr, "\n PL/Python function \"%s\", line %ld, in %s",
&tbstr, "\n PL/Python function \"%s\", line %ld, in %s",
proname, plain_lineno - 1, fname); proname, plain_lineno - 1, fname);
/* /*

View File

@ -2746,8 +2746,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
if (strlen(nulls) != qdesc->nargs) if (strlen(nulls) != qdesc->nargs)
{ {
Tcl_SetObjResult(interp, Tcl_SetObjResult(interp,
Tcl_NewStringObj( Tcl_NewStringObj("length of nulls string doesn't match number of arguments",
"length of nulls string doesn't match number of arguments",
-1)); -1));
return TCL_ERROR; return TCL_ERROR;
} }
@ -2762,9 +2761,8 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
if (i >= objc) if (i >= objc)
{ {
Tcl_SetObjResult(interp, Tcl_SetObjResult(interp,
Tcl_NewStringObj( Tcl_NewStringObj("argument list length doesn't match number of arguments for query",
"argument list length doesn't match number of arguments for query" -1));
,-1));
return TCL_ERROR; return TCL_ERROR;
} }

View File

@ -74,8 +74,7 @@ init_gettimeofday(LPFILETIME lpSystemTimeAsFileTime)
* and determining the windows version is its self somewhat Windows * and determining the windows version is its self somewhat Windows
* version and development SDK specific... * version and development SDK specific...
*/ */
pg_get_system_time = (PgGetSystemTimeFn) GetProcAddress( pg_get_system_time = (PgGetSystemTimeFn) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
GetModuleHandle(TEXT("kernel32.dll")),
"GetSystemTimePreciseAsFileTime"); "GetSystemTimePreciseAsFileTime");
if (pg_get_system_time == NULL) if (pg_get_system_time == NULL)
{ {