48 bool strong_implied_by,
68 elog(
ERROR,
"SPI_prepare failed for \"%s\"", query_string);
72 elog(
ERROR,
"failed to execute \"%s\"", query_string);
74 if (tupdesc->
natts != 2 ||
77 elog(
ERROR,
"query must yield two boolean columns");
79 s_i_holds = w_i_holds = s_r_holds = w_r_holds =
true;
108 if (c2 ==
't' && c1 !=
't')
111 if (c2 !=
'f' && c1 ==
'f')
114 if (c2 ==
't' && c1 !=
'f')
117 if (c2 ==
't' && c1 ==
't')
128 elog(
ERROR,
"failed to decipher query plan");
131 elog(
ERROR,
"failed to decipher query plan");
173 if (strong_implied_by && !s_i_holds)
174 elog(
WARNING,
"strong_implied_by result is incorrect");
175 if (weak_implied_by && !w_i_holds)
176 elog(
WARNING,
"weak_implied_by result is incorrect");
177 if (strong_refuted_by && !s_r_holds)
178 elog(
WARNING,
"strong_refuted_by result is incorrect");
179 if (weak_refuted_by && !w_r_holds)
180 elog(
WARNING,
"weak_refuted_by result is incorrect");
190 "strong_implied_by", BOOLOID, -1, 0);
192 "weak_implied_by", BOOLOID, -1, 0);
194 "strong_refuted_by", BOOLOID, -1, 0);
196 "weak_refuted_by", BOOLOID, -1, 0);
198 "s_i_holds", BOOLOID, -1, 0);
200 "w_i_holds", BOOLOID, -1, 0);
202 "s_r_holds", BOOLOID, -1, 0);
204 "w_r_holds", BOOLOID, -1, 0);
static Datum values[MAXATTR]
elog(ERROR, "%s: %s", p2, msg)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_DATUM(x)
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * make_ands_implicit(Expr *clause)
static int list_length(const List *l)
#define linitial_node(type, l)
#define lsecond_node(type, l)
static bool DatumGetBool(Datum X)
static Datum BoolGetDatum(bool X)
bool predicate_refuted_by(List *predicate_list, List *clause_list, bool weak)
bool predicate_implied_by(List *predicate_list, List *clause_list, bool weak)
CachedPlan * SPI_plan_get_cached_plan(SPIPlanPtr plan)
SPITupleTable * SPI_tuptable
int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only, long tcount)
SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes)
Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
Datum test_predtest(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(test_predtest)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
#define TupleDescAttr(tupdesc, i)
char * text_to_cstring(const text *t)