<synopsis>
int SPI_execute_with_args(const char *<parameter>command</parameter>,
int <parameter>nargs</parameter>, Oid *<parameter>argtypes</parameter>,
- Datum *<parameter>values</parameter>, const char *<parameter>nulls</parameter>,
+ const Datum *<parameter>values</parameter>, const char *<parameter>nulls</parameter>,
bool <parameter>read_only</parameter>, long <parameter>count</parameter>)
</synopsis>
</refsynopsisdiv>
<refsynopsisdiv>
<synopsis>
-int SPI_execute_plan(SPIPlanPtr <parameter>plan</parameter>, Datum * <parameter>values</parameter>, const char * <parameter>nulls</parameter>,
+int SPI_execute_plan(SPIPlanPtr <parameter>plan</parameter>, const Datum * <parameter>values</parameter>, const char * <parameter>nulls</parameter>,
bool <parameter>read_only</parameter>, long <parameter>count</parameter>)
</synopsis>
</refsynopsisdiv>
Portal SPI_cursor_open_with_args(const char *<parameter>name</parameter>,
const char *<parameter>command</parameter>,
int <parameter>nargs</parameter>, Oid *<parameter>argtypes</parameter>,
- Datum *<parameter>values</parameter>, const char *<parameter>nulls</parameter>,
+ const Datum *<parameter>values</parameter>, const char *<parameter>nulls</parameter>,
bool <parameter>read_only</parameter>, int <parameter>cursorOptions</parameter>)
</synopsis>
</refsynopsisdiv>
* function (which should be BTLessStrategyNumber).
*/
static void
-AssertArrayOrder(FmgrInfo *cmp, Oid colloid, Datum *values, int nvalues)
+AssertArrayOrder(FmgrInfo *cmp, Oid colloid, const Datum *values, int nvalues)
{
int i;
Datum lt;
*/
bool
_hash_convert_tuple(Relation index,
- Datum *user_values, bool *user_isnull,
+ const Datum *user_values, const bool *user_isnull,
Datum *index_values, bool *index_isnull)
{
uint32 hashkey;
*/
HeapTuple
toast_build_flattened_tuple(TupleDesc tupleDesc,
- Datum *values,
- bool *isnull)
+ const Datum *values,
+ const bool *isnull)
{
HeapTuple new_tuple;
int numAttrs = tupleDesc->natts;
int *numSkipArrayKeys_out);
static Datum _bt_find_extreme_element(IndexScanDesc scan, ScanKey skey,
Oid elemtype, StrategyNumber strat,
- Datum *elems, int nelems);
+ const Datum *elems, int nelems);
static void _bt_setup_array_cmp(IndexScanDesc scan, ScanKey skey, Oid elemtype,
FmgrInfo *orderproc, FmgrInfo **sortprocp);
static int _bt_sort_array_elements(ScanKey skey, FmgrInfo *sortproc,
static Datum
_bt_find_extreme_element(IndexScanDesc scan, ScanKey skey, Oid elemtype,
StrategyNumber strat,
- Datum *elems, int nelems)
+ const Datum *elems, int nelems)
{
Relation rel = scan->indexRelation;
Oid cmp_op;
BTBuildState *buildstate, IndexInfo *indexInfo);
static void _bt_spooldestroy(BTSpool *btspool);
static void _bt_spool(BTSpool *btspool, const ItemPointerData *self,
- Datum *values, bool *isnull);
+ const Datum *values, const bool *isnull);
static void _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2);
static void _bt_build_callback(Relation index, ItemPointer tid, Datum *values,
bool *isnull, bool tupleIsAlive, void *state);
* spool an index entry into the sort file.
*/
static void
-_bt_spool(BTSpool *btspool, const ItemPointerData *self, Datum *values, bool *isnull)
+_bt_spool(BTSpool *btspool, const ItemPointerData *self, const Datum *values, const bool *isnull)
{
tuplesort_putindextuplevalues(btspool->sortstate, btspool->index,
self, values, isnull);
*/
bool
spgdoinsert(Relation index, SpGistState *state,
- const ItemPointerData *heapPtr, Datum *datums, bool *isnulls)
+ const ItemPointerData *heapPtr, const Datum *datums, const bool *isnulls)
{
bool result = true;
TupleDesc leafDescriptor = state->leafTupDesc;
* On success, *i gets the match location; on failure, it gets where to insert
*/
static bool
-searchChar(Datum *nodeLabels, int nNodes, int16 c, int *i)
+searchChar(const Datum *nodeLabels, int nNodes, int16 c, int *i)
{
int StopLow = 0,
StopHigh = nNodes;
EState *estate,
Datum *values,
bool *isnull);
-static int get_partition_for_tuple(PartitionDispatch pd, Datum *values,
- bool *isnull);
+static int get_partition_for_tuple(PartitionDispatch pd, const Datum *values,
+ const bool *isnull);
static char *ExecBuildSlotPartitionKeyDescription(Relation rel,
- Datum *values,
- bool *isnull,
+ const Datum *values,
+ const bool *isnull,
int maxfieldlen);
static List *adjust_partition_colnos(List *colnos, ResultRelInfo *leaf_part_rri);
static List *adjust_partition_colnos_using_map(List *colnos, AttrMap *attrMap);
* found or -1 if none found.
*/
static int
-get_partition_for_tuple(PartitionDispatch pd, Datum *values, bool *isnull)
+get_partition_for_tuple(PartitionDispatch pd, const Datum *values, const bool *isnull)
{
int bound_offset = -1;
int part_index = -1;
*/
static char *
ExecBuildSlotPartitionKeyDescription(Relation rel,
- Datum *values,
- bool *isnull,
+ const Datum *values,
+ const bool *isnull,
int maxfieldlen)
{
StringInfoData buf;
static int reorderqueue_cmp(const pairingheap_node *a,
const pairingheap_node *b, void *arg);
static void reorderqueue_push(IndexScanState *node, TupleTableSlot *slot,
- Datum *orderbyvals, bool *orderbynulls);
+ const Datum *orderbyvals, const bool *orderbynulls);
static HeapTuple reorderqueue_pop(IndexScanState *node);
*/
static void
reorderqueue_push(IndexScanState *node, TupleTableSlot *slot,
- Datum *orderbyvals, bool *orderbynulls)
+ const Datum *orderbyvals, const bool *orderbynulls)
{
IndexScanDesc scandesc = node->iss_ScanDesc;
EState *estate = node->ss.ps.state;
bool fire_triggers);
static ParamListInfo _SPI_convert_params(int nargs, Oid *argtypes,
- Datum *Values, const char *Nulls);
+ const Datum *Values, const char *Nulls);
static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, uint64 tcount);
/* Execute a previously prepared plan */
int
-SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
+SPI_execute_plan(SPIPlanPtr plan, const Datum *Values, const char *Nulls,
bool read_only, long tcount)
{
SPIExecuteOptions options;
*/
int
SPI_execute_snapshot(SPIPlanPtr plan,
- Datum *Values, const char *Nulls,
+ const Datum *Values, const char *Nulls,
Snapshot snapshot, Snapshot crosscheck_snapshot,
bool read_only, bool fire_triggers, long tcount)
{
int
SPI_execute_with_args(const char *src,
int nargs, Oid *argtypes,
- Datum *Values, const char *Nulls,
+ const Datum *Values, const char *Nulls,
bool read_only, long tcount)
{
int res;
*/
Portal
SPI_cursor_open(const char *name, SPIPlanPtr plan,
- Datum *Values, const char *Nulls,
+ const Datum *Values, const char *Nulls,
bool read_only)
{
Portal portal;
*/
static ParamListInfo
_SPI_convert_params(int nargs, Oid *argtypes,
- Datum *Values, const char *Nulls)
+ const Datum *Values, const char *Nulls)
{
ParamListInfo paramLI;
*/
int32
partition_rbound_datum_cmp(FmgrInfo *partsupfunc, Oid *partcollation,
- Datum *rb_datums, PartitionRangeDatumKind *rb_kind,
- Datum *tuple_datums, int n_tuple_datums)
+ const Datum *rb_datums, PartitionRangeDatumKind *rb_kind,
+ const Datum *tuple_datums, int n_tuple_datums)
{
int i;
int32 cmpval = -1;
int
partition_range_datum_bsearch(FmgrInfo *partsupfunc, Oid *partcollation,
PartitionBoundInfo boundinfo,
- int nvalues, Datum *values, bool *is_equal)
+ int nvalues, const Datum *values, bool *is_equal)
{
int lo,
hi,
List *step_exprs,
List *step_cmpfns);
static PruneStepResult *get_matching_hash_bounds(PartitionPruneContext *context,
- StrategyNumber opstrategy, Datum *values, int nvalues,
+ StrategyNumber opstrategy, const Datum *values, int nvalues,
FmgrInfo *partsupfunc, Bitmapset *nullkeys);
static PruneStepResult *get_matching_list_bounds(PartitionPruneContext *context,
StrategyNumber opstrategy, Datum value, int nvalues,
FmgrInfo *partsupfunc, Bitmapset *nullkeys);
static PruneStepResult *get_matching_range_bounds(PartitionPruneContext *context,
- StrategyNumber opstrategy, Datum *values, int nvalues,
+ StrategyNumber opstrategy, const Datum *values, int nvalues,
FmgrInfo *partsupfunc, Bitmapset *nullkeys);
static Bitmapset *pull_exec_paramids(Expr *expr);
static bool pull_exec_paramids_walker(Node *node, Bitmapset **context);
*/
static PruneStepResult *
get_matching_hash_bounds(PartitionPruneContext *context,
- StrategyNumber opstrategy, Datum *values, int nvalues,
+ StrategyNumber opstrategy, const Datum *values, int nvalues,
FmgrInfo *partsupfunc, Bitmapset *nullkeys)
{
PruneStepResult *result = (PruneStepResult *) palloc0(sizeof(PruneStepResult));
*/
static PruneStepResult *
get_matching_range_bounds(PartitionPruneContext *context,
- StrategyNumber opstrategy, Datum *values, int nvalues,
+ StrategyNumber opstrategy, const Datum *values, int nvalues,
FmgrInfo *partsupfunc, Bitmapset *nullkeys)
{
PruneStepResult *result = (PruneStepResult *) palloc0(sizeof(PruneStepResult));
Datum stanumbers, bool stanumbers_isnull,
Datum stavalues, bool stavalues_isnull);
static void upsert_pg_statistic(Relation starel, HeapTuple oldtup,
- Datum *values, bool *nulls, bool *replaces);
+ const Datum *values, const bool *nulls, const bool *replaces);
static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit);
static void init_empty_stats_tuple(Oid reloid, int16 attnum, bool inherited,
Datum *values, bool *nulls, bool *replaces);
*/
static void
upsert_pg_statistic(Relation starel, HeapTuple oldtup,
- Datum *values, bool *nulls, bool *replaces)
+ const Datum *values, const bool *nulls, const bool *replaces)
{
HeapTuple newtup;
static Selectivity tsquerysel(VariableStatData *vardata, Datum constval);
static Selectivity mcelem_tsquery_selec(TSQuery query,
- Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers);
+ const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers);
static Selectivity tsquery_opr_selec(QueryItem *item, char *operand,
TextFreq *lookup, int length, float4 minfreq);
static int compare_lexeme_textfreq(const void *e1, const void *e2);
* Extract data from the pg_statistic arrays into useful format.
*/
static Selectivity
-mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers)
+mcelem_tsquery_selec(TSQuery query, const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers)
{
float4 minfreq;
TextFreq *lookup;
static Selectivity calc_arraycontsel(VariableStatData *vardata, Datum constval,
Oid elemtype, Oid operator);
-static Selectivity mcelem_array_selec(ArrayType *array,
+static Selectivity mcelem_array_selec(const ArrayType *array,
TypeCacheEntry *typentry,
- Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers,
- float4 *hist, int nhist,
+ const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers,
+ const float4 *hist, int nhist,
Oid operator);
-static Selectivity mcelem_array_contain_overlap_selec(Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers,
- Datum *array_data, int nitems,
+static Selectivity mcelem_array_contain_overlap_selec(const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers,
+ const Datum *array_data, int nitems,
Oid operator, TypeCacheEntry *typentry);
-static Selectivity mcelem_array_contained_selec(Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers,
- Datum *array_data, int nitems,
- float4 *hist, int nhist,
+static Selectivity mcelem_array_contained_selec(const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers,
+ const Datum *array_data, int nitems,
+ const float4 *hist, int nhist,
Oid operator, TypeCacheEntry *typentry);
static float *calc_hist(const float4 *hist, int nhist, int n);
static float *calc_distr(const float *p, int n, int m, float rest);
static int floor_log2(uint32 n);
-static bool find_next_mcelem(Datum *mcelem, int nmcelem, Datum value,
+static bool find_next_mcelem(const Datum *mcelem, int nmcelem, Datum value,
int *index, TypeCacheEntry *typentry);
static int element_compare(const void *key1, const void *key2, void *arg);
static int float_compare_desc(const void *key1, const void *key2);
* mcelem_array_contained_selec depending on the operator.
*/
static Selectivity
-mcelem_array_selec(ArrayType *array, TypeCacheEntry *typentry,
- Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers,
- float4 *hist, int nhist,
+mcelem_array_selec(const ArrayType *array, TypeCacheEntry *typentry,
+ const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers,
+ const float4 *hist, int nhist,
Oid operator)
{
Selectivity selec;
* fraction of nonempty arrays in the column.
*/
static Selectivity
-mcelem_array_contain_overlap_selec(Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers,
- Datum *array_data, int nitems,
+mcelem_array_contain_overlap_selec(const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers,
+ const Datum *array_data, int nitems,
Oid operator, TypeCacheEntry *typentry)
{
Selectivity selec,
* ... * fn^on * (1 - fn)^(1 - on), o1, o2, ..., on) | o1 + o2 + .. on = m
*/
static Selectivity
-mcelem_array_contained_selec(Datum *mcelem, int nmcelem,
- float4 *numbers, int nnumbers,
- Datum *array_data, int nitems,
- float4 *hist, int nhist,
+mcelem_array_contained_selec(const Datum *mcelem, int nmcelem,
+ const float4 *numbers, int nnumbers,
+ const Datum *array_data, int nitems,
+ const float4 *hist, int nhist,
Oid operator, TypeCacheEntry *typentry)
{
int mcelem_index,
* exact match.)
*/
static bool
-find_next_mcelem(Datum *mcelem, int nmcelem, Datum value, int *index,
+find_next_mcelem(const Datum *mcelem, int nmcelem, Datum value, int *index,
TypeCacheEntry *typentry)
{
int l = *index,
*/
void
CopyArrayEls(ArrayType *array,
- Datum *values,
- bool *nulls,
+ const Datum *values,
+ const bool *nulls,
int nitems,
int typlen,
bool typbyval,
* to hard-wire values if the element type is hard-wired.
*/
void
-deconstruct_array(ArrayType *array,
+deconstruct_array(const ArrayType *array,
Oid elmtype,
int elmlen, bool elmbyval, char elmalign,
Datum **elemsp, bool **nullsp, int *nelemsp)
* useful when manipulating arrays from/for system catalogs.
*/
void
-deconstruct_array_builtin(ArrayType *array,
+deconstruct_array_builtin(const ArrayType *array,
Oid elmtype,
Datum **elemsp, bool **nullsp, int *nelemsp)
{
* if the array *might* contain a null.
*/
bool
-array_contains_nulls(ArrayType *array)
+array_contains_nulls(const ArrayType *array)
{
int nelems;
bits8 *bitmap;
static void composite_to_json(Datum composite, StringInfo result,
bool use_line_feeds);
static void array_dim_to_json(StringInfo result, int dim, int ndims, int *dims,
- Datum *vals, bool *nulls, int *valcount,
+ const Datum *vals, const bool *nulls, int *valcount,
JsonTypeCategory tcategory, Oid outfuncoid,
bool use_line_feeds);
static void array_to_json_internal(Datum array, StringInfo result,
* ourselves recursively to process the next dimension.
*/
static void
-array_dim_to_json(StringInfo result, int dim, int ndims, int *dims, Datum *vals,
- bool *nulls, int *valcount, JsonTypeCategory tcategory,
+array_dim_to_json(StringInfo result, int dim, int ndims, int *dims, const Datum *vals,
+ const bool *nulls, int *valcount, JsonTypeCategory tcategory,
Oid outfuncoid, bool use_line_feeds)
{
int i;
/* functions supporting jsonb_delete, jsonb_set and jsonb_concat */
static JsonbValue *IteratorConcat(JsonbIterator **it1, JsonbIterator **it2,
JsonbParseState **state);
-static JsonbValue *setPath(JsonbIterator **it, Datum *path_elems,
- bool *path_nulls, int path_len,
+static JsonbValue *setPath(JsonbIterator **it, const Datum *path_elems,
+ const bool *path_nulls, int path_len,
JsonbParseState **st, int level, JsonbValue *newval,
int op_type);
-static void setPathObject(JsonbIterator **it, Datum *path_elems,
- bool *path_nulls, int path_len, JsonbParseState **st,
+static void setPathObject(JsonbIterator **it, const Datum *path_elems,
+ const bool *path_nulls, int path_len, JsonbParseState **st,
int level,
JsonbValue *newval, uint32 npairs, int op_type);
-static void setPathArray(JsonbIterator **it, Datum *path_elems,
- bool *path_nulls, int path_len, JsonbParseState **st,
+static void setPathArray(JsonbIterator **it, const Datum *path_elems,
+ const bool *path_nulls, int path_len, JsonbParseState **st,
int level,
JsonbValue *newval, uint32 nelems, int op_type);
}
Datum
-jsonb_get_element(Jsonb *jb, Datum *path, int npath, bool *isnull, bool as_text)
+jsonb_get_element(Jsonb *jb, const Datum *path, int npath, bool *isnull, bool as_text)
{
JsonbContainer *container = &jb->root;
JsonbValue *jbvp = NULL;
}
Datum
-jsonb_set_element(Jsonb *jb, Datum *path, int path_len,
+jsonb_set_element(Jsonb *jb, const Datum *path, int path_len,
JsonbValue *newval)
{
JsonbValue *res;
* Caller is responsible to make sure such path does not exist yet.
*/
static void
-push_path(JsonbParseState **st, int level, Datum *path_elems,
- bool *path_nulls, int path_len, JsonbValue *newval)
+push_path(JsonbParseState **st, int level, const Datum *path_elems,
+ const bool *path_nulls, int path_len, JsonbValue *newval)
{
/*
* tpath contains expected type of an empty jsonb created at each level
* whatever bits in op_type are set, or nothing is done.
*/
static JsonbValue *
-setPath(JsonbIterator **it, Datum *path_elems,
- bool *path_nulls, int path_len,
+setPath(JsonbIterator **it, const Datum *path_elems,
+ const bool *path_nulls, int path_len,
JsonbParseState **st, int level, JsonbValue *newval, int op_type)
{
JsonbValue v;
* Object walker for setPath
*/
static void
-setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
+setPathObject(JsonbIterator **it, const Datum *path_elems, const bool *path_nulls,
int path_len, JsonbParseState **st, int level,
JsonbValue *newval, uint32 npairs, int op_type)
{
* Array walker for setPath
*/
static void
-setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
+setPathArray(JsonbIterator **it, const Datum *path_elems, const bool *path_nulls,
int path_len, JsonbParseState **st, int level,
JsonbValue *newval, uint32 nelems, int op_type)
{
static float8 get_len_position(double value, double hist1, double hist2);
static float8 get_distance(TypeCacheEntry *typcache, const RangeBound *bound1,
const RangeBound *bound2);
-static int length_hist_bsearch(Datum *length_hist_values,
+static int length_hist_bsearch(const Datum *length_hist_values,
int length_hist_nvalues, double value,
bool equal);
-static double calc_length_hist_frac(Datum *length_hist_values,
+static double calc_length_hist_frac(const Datum *length_hist_values,
int length_hist_nvalues, double length1,
double length2, bool equal);
static double calc_hist_selectivity_contained(TypeCacheEntry *typcache,
RangeBound *upper,
const RangeBound *hist_lower,
int hist_nvalues,
- Datum *length_hist_values,
+ const Datum *length_hist_values,
int length_hist_nvalues);
static double calc_hist_selectivity_contains(TypeCacheEntry *typcache,
const RangeBound *lower,
const RangeBound *upper,
const RangeBound *hist_lower,
int hist_nvalues,
- Datum *length_hist_values,
+ const Datum *length_hist_values,
int length_hist_nvalues);
/*
* given length, returns -1.
*/
static int
-length_hist_bsearch(Datum *length_hist_values, int length_hist_nvalues,
+length_hist_bsearch(const Datum *length_hist_values, int length_hist_nvalues,
double value, bool equal)
{
int lower = -1,
* 'equal' is true).
*/
static double
-calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
+calc_length_hist_frac(const Datum *length_hist_values, int length_hist_nvalues,
double length1, double length2, bool equal)
{
double frac;
calc_hist_selectivity_contained(TypeCacheEntry *typcache,
const RangeBound *lower, RangeBound *upper,
const RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues)
+ const Datum *length_hist_values, int length_hist_nvalues)
{
int i,
upper_index;
calc_hist_selectivity_contains(TypeCacheEntry *typcache,
const RangeBound *lower, const RangeBound *upper,
const RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues)
+ const Datum *length_hist_values, int length_hist_nvalues)
{
int i,
lower_index;
static Selectivity networkjoinsel_semi(Oid operator,
VariableStatData *vardata1, VariableStatData *vardata2);
static Selectivity mcv_population(float4 *mcv_numbers, int mcv_nvalues);
-static Selectivity inet_hist_value_sel(Datum *values, int nvalues,
+static Selectivity inet_hist_value_sel(const Datum *values, int nvalues,
Datum constvalue, int opr_codenum);
static Selectivity inet_mcv_join_sel(Datum *mcv1_values,
float4 *mcv1_numbers, int mcv1_nvalues, Datum *mcv2_values,
float4 *mcv2_numbers, int mcv2_nvalues, Oid operator);
-static Selectivity inet_mcv_hist_sel(Datum *mcv_values, float4 *mcv_numbers,
- int mcv_nvalues, Datum *hist_values, int hist_nvalues,
+static Selectivity inet_mcv_hist_sel(const Datum *mcv_values, float4 *mcv_numbers,
+ int mcv_nvalues, const Datum *hist_values, int hist_nvalues,
int opr_codenum);
-static Selectivity inet_hist_inclusion_join_sel(Datum *hist1_values,
+static Selectivity inet_hist_inclusion_join_sel(const Datum *hist1_values,
int hist1_nvalues,
- Datum *hist2_values, int hist2_nvalues,
+ const Datum *hist2_values, int hist2_nvalues,
int opr_codenum);
static Selectivity inet_semi_join_sel(Datum lhs_value,
bool mcv_exists, Datum *mcv_values, int mcv_nvalues,
* better option than not considering these buckets at all.
*/
static Selectivity
-inet_hist_value_sel(Datum *values, int nvalues, Datum constvalue,
+inet_hist_value_sel(const Datum *values, int nvalues, Datum constvalue,
int opr_codenum)
{
Selectivity match = 0.0;
* the histogram.
*/
static Selectivity
-inet_mcv_hist_sel(Datum *mcv_values, float4 *mcv_numbers, int mcv_nvalues,
- Datum *hist_values, int hist_nvalues,
+inet_mcv_hist_sel(const Datum *mcv_values, float4 *mcv_numbers, int mcv_nvalues,
+ const Datum *hist_values, int hist_nvalues,
int opr_codenum)
{
Selectivity selec = 0.0;
* average? That would at least avoid non-commutative estimation results.
*/
static Selectivity
-inet_hist_inclusion_join_sel(Datum *hist1_values, int hist1_nvalues,
- Datum *hist2_values, int hist2_nvalues,
+inet_hist_inclusion_join_sel(const Datum *hist1_values, int hist1_nvalues,
+ const Datum *hist2_values, int hist2_nvalues,
int opr_codenum)
{
double match = 0.0;
*/
static struct pct_info *
setup_pct_info(int num_percentiles,
- Datum *percentiles_datum,
- bool *percentiles_null,
+ const Datum *percentiles_datum,
+ const bool *percentiles_null,
int64 rowcount,
bool continuous)
{
static float8 get_len_position(double value, double hist1, double hist2);
static float8 get_distance(TypeCacheEntry *typcache, const RangeBound *bound1,
const RangeBound *bound2);
-static int length_hist_bsearch(Datum *length_hist_values,
+static int length_hist_bsearch(const Datum *length_hist_values,
int length_hist_nvalues, double value, bool equal);
-static double calc_length_hist_frac(Datum *length_hist_values,
+static double calc_length_hist_frac(const Datum *length_hist_values,
int length_hist_nvalues, double length1, double length2, bool equal);
static double calc_hist_selectivity_contained(TypeCacheEntry *typcache,
const RangeBound *lower, RangeBound *upper,
const RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues);
+ const Datum *length_hist_values, int length_hist_nvalues);
static double calc_hist_selectivity_contains(TypeCacheEntry *typcache,
const RangeBound *lower, const RangeBound *upper,
const RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues);
+ const Datum *length_hist_values, int length_hist_nvalues);
/*
* Returns a default selectivity estimate for given operator, when we don't
* given length, returns -1.
*/
static int
-length_hist_bsearch(Datum *length_hist_values, int length_hist_nvalues,
+length_hist_bsearch(const Datum *length_hist_values, int length_hist_nvalues,
double value, bool equal)
{
int lower = -1,
* 'equal' is true).
*/
static double
-calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
+calc_length_hist_frac(const Datum *length_hist_values, int length_hist_nvalues,
double length1, double length2, bool equal)
{
double frac;
calc_hist_selectivity_contained(TypeCacheEntry *typcache,
const RangeBound *lower, RangeBound *upper,
const RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues)
+ const Datum *length_hist_values, int length_hist_nvalues)
{
int i,
upper_index;
calc_hist_selectivity_contains(TypeCacheEntry *typcache,
const RangeBound *lower, const RangeBound *upper,
const RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues)
+ const Datum *length_hist_values, int length_hist_nvalues)
{
int i,
lower_index;
xmltype *
xmlelement(XmlExpr *xexpr,
- Datum *named_argvalue, bool *named_argnull,
- Datum *argvalue, bool *argnull)
+ const Datum *named_argvalue, const bool *named_argnull,
+ const Datum *argvalue, const bool *argnull)
{
#ifdef USE_LIBXML
xmltype *result;
static void ReleaseCatCacheWithOwner(HeapTuple tuple, ResourceOwner resowner);
static void ReleaseCatCacheListWithOwner(CatCList *list, ResourceOwner resowner);
-static void CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos,
- Datum *keys);
-static void CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
- Datum *srckeys, Datum *dstkeys);
+static void CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, const int *attnos,
+ const Datum *keys);
+static void CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, const int *attnos,
+ const Datum *srckeys, Datum *dstkeys);
/*
* Helper routine that frees keys stored in the keys array.
*/
static void
-CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos, Datum *keys)
+CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, const int *attnos, const Datum *keys)
{
int i;
* context.
*/
static void
-CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
- Datum *srckeys, Datum *dstkeys)
+CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, const int *attnos,
+ const Datum *srckeys, Datum *dstkeys)
{
int i;
extern void _hash_checkpage(Relation rel, Buffer buf, int flags);
extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup);
extern bool _hash_convert_tuple(Relation index,
- Datum *user_values, bool *user_isnull,
+ const Datum *user_values, const bool *user_isnull,
Datum *index_values, bool *index_isnull);
extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value);
extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value);
* ----------
*/
extern HeapTuple toast_build_flattened_tuple(TupleDesc tupleDesc,
- Datum *values,
- bool *isnull);
+ const Datum *values,
+ const bool *isnull);
/* ----------
* heap_fetch_toast_slice
int firststate, int reststate,
BlockNumber blkno, OffsetNumber offnum);
extern bool spgdoinsert(Relation index, SpGistState *state,
- const ItemPointerData *heapPtr, Datum *datums, bool *isnulls);
+ const ItemPointerData *heapPtr, const Datum *datums, const bool *isnulls);
/* spgproc.c */
extern double *spg_key_orderbys_distances(Datum key, bool isLeaf,
extern int SPI_execute(const char *src, bool read_only, long tcount);
extern int SPI_execute_extended(const char *src,
const SPIExecuteOptions *options);
-extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
+extern int SPI_execute_plan(SPIPlanPtr plan, const Datum *Values, const char *Nulls,
bool read_only, long tcount);
extern int SPI_execute_plan_extended(SPIPlanPtr plan,
const SPIExecuteOptions *options);
extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls,
long tcount);
extern int SPI_execute_snapshot(SPIPlanPtr plan,
- Datum *Values, const char *Nulls,
+ const Datum *Values, const char *Nulls,
Snapshot snapshot,
Snapshot crosscheck_snapshot,
bool read_only, bool fire_triggers, long tcount);
extern int SPI_execute_with_args(const char *src,
int nargs, Oid *argtypes,
- Datum *Values, const char *Nulls,
+ const Datum *Values, const char *Nulls,
bool read_only, long tcount);
extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes);
extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes,
extern void SPI_freetuptable(SPITupleTable *tuptable);
extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan,
- Datum *Values, const char *Nulls, bool read_only);
+ const Datum *Values, const char *Nulls, bool read_only);
extern Portal SPI_cursor_open_with_args(const char *name,
const char *src,
int nargs, Oid *argtypes,
extern int32 partition_rbound_datum_cmp(FmgrInfo *partsupfunc,
Oid *partcollation,
- Datum *rb_datums, PartitionRangeDatumKind *rb_kind,
- Datum *tuple_datums, int n_tuple_datums);
+ const Datum *rb_datums, PartitionRangeDatumKind *rb_kind,
+ const Datum *tuple_datums, int n_tuple_datums);
extern int partition_list_bsearch(FmgrInfo *partsupfunc,
Oid *partcollation,
PartitionBoundInfo boundinfo,
extern int partition_range_datum_bsearch(FmgrInfo *partsupfunc,
Oid *partcollation,
PartitionBoundInfo boundinfo,
- int nvalues, Datum *values, bool *is_equal);
+ int nvalues, const Datum *values, bool *is_equal);
extern int partition_hash_bsearch(PartitionBoundInfo boundinfo,
int modulus, int remainder);
* prototypes for functions defined in arrayfuncs.c
*/
extern void CopyArrayEls(ArrayType *array,
- Datum *values,
- bool *nulls,
+ const Datum *values,
+ const bool *nulls,
int nitems,
int typlen,
bool typbyval,
extern ExpandedArrayHeader *construct_empty_expanded_array(Oid element_type,
MemoryContext parentcontext,
ArrayMetaState *metacache);
-extern void deconstruct_array(ArrayType *array,
+extern void deconstruct_array(const ArrayType *array,
Oid elmtype,
int elmlen, bool elmbyval, char elmalign,
Datum **elemsp, bool **nullsp, int *nelemsp);
-extern void deconstruct_array_builtin(ArrayType *array,
+extern void deconstruct_array_builtin(const ArrayType *array,
Oid elmtype,
Datum **elemsp, bool **nullsp, int *nelemsp);
-extern bool array_contains_nulls(ArrayType *array);
+extern bool array_contains_nulls(const ArrayType *array);
extern ArrayBuildState *initArrayResult(Oid element_type,
MemoryContext rcontext, bool subcontext);
extern bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res);
extern const char *JsonbTypeName(JsonbValue *val);
-extern Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len,
+extern Datum jsonb_set_element(Jsonb *jb, const Datum *path, int path_len,
JsonbValue *newval);
-extern Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath,
+extern Datum jsonb_get_element(Jsonb *jb, const Datum *path, int npath,
bool *isnull, bool as_text);
extern bool to_jsonb_is_immutable(Oid typoid);
extern Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls,
extern xmltype *xmlconcat(List *args);
extern xmltype *xmlelement(XmlExpr *xexpr,
- Datum *named_argvalue, bool *named_argnull,
- Datum *argvalue, bool *argnull);
+ const Datum *named_argvalue, const bool *named_argnull,
+ const Datum *argvalue, const bool *argnull);
extern xmltype *xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace);
extern xmltype *xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null);
extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
* On success, *i gets the match location; on failure, it gets where to insert
*/
static bool
-searchChar(Datum *nodeLabels, int nNodes, int16 c, int *i)
+searchChar(const Datum *nodeLabels, int nNodes, int16 c, int *i)
{
int StopLow = 0,
StopHigh = nNodes;