PG_FUNCTION_INFO_V1(bt_index_parent_check);
static void bt_index_check_internal(Oid indrelid, bool parentcheck,
- bool heapallindexed, bool rootdescend);
+ bool heapallindexed, bool rootdescend);
static inline void btree_index_checkable(Relation rel);
static void bt_check_every_level(Relation rel, Relation heaprel,
- bool heapkeyspace, bool readonly, bool heapallindexed,
- bool rootdescend);
+ bool heapkeyspace, bool readonly, bool heapallindexed,
+ bool rootdescend);
static BtreeLevel bt_check_level_from_leftmost(BtreeCheckState *state,
- BtreeLevel level);
+ BtreeLevel level);
static void bt_target_page_check(BtreeCheckState *state);
static BTScanInsert bt_right_page_check_scankey(BtreeCheckState *state);
static void bt_downlink_check(BtreeCheckState *state, BTScanInsert targetkey,
- BlockNumber childblock);
+ BlockNumber childblock);
static void bt_downlink_missing_check(BtreeCheckState *state);
static void bt_tuple_present_callback(Relation index, HeapTuple htup,
- Datum *values, bool *isnull,
- bool tupleIsAlive, void *checkstate);
+ Datum *values, bool *isnull,
+ bool tupleIsAlive, void *checkstate);
static IndexTuple bt_normalize_tuple(BtreeCheckState *state,
- IndexTuple itup);
+ IndexTuple itup);
static bool bt_rootdescend(BtreeCheckState *state, IndexTuple itup);
static inline bool offset_is_negative_infinity(BTPageOpaque opaque,
- OffsetNumber offset);
+ OffsetNumber offset);
static inline bool invariant_l_offset(BtreeCheckState *state, BTScanInsert key,
- OffsetNumber upperbound);
+ OffsetNumber upperbound);
static inline bool invariant_leq_offset(BtreeCheckState *state,
- BTScanInsert key,
- OffsetNumber upperbound);
+ BTScanInsert key,
+ OffsetNumber upperbound);
static inline bool invariant_g_offset(BtreeCheckState *state, BTScanInsert key,
- OffsetNumber lowerbound);
+ OffsetNumber lowerbound);
static inline bool invariant_l_nontarget_offset(BtreeCheckState *state,
- BTScanInsert key,
- BlockNumber nontargetblock,
- Page nontarget,
- OffsetNumber upperbound);
+ BTScanInsert key,
+ BlockNumber nontargetblock,
+ Page nontarget,
+ OffsetNumber upperbound);
static Page palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum);
static inline BTScanInsert bt_mkscankey_pivotsearch(Relation rel,
- IndexTuple itup);
+ IndexTuple itup);
static ItemId PageGetItemIdCareful(BtreeCheckState *state, BlockNumber block,
- Page page, OffsetNumber offset);
+ Page page, OffsetNumber offset);
static inline ItemPointer BTreeTupleGetHeapTIDCareful(BtreeCheckState *state,
- IndexTuple itup, bool nonpivot);
+ IndexTuple itup, bool nonpivot);
/*
* bt_index_check(index regclass, heapallindexed boolean)
static void explain_ExecutorStart(QueryDesc *queryDesc, int eflags);
static void explain_ExecutorRun(QueryDesc *queryDesc,
- ScanDirection direction,
- uint64 count, bool execute_once);
+ ScanDirection direction,
+ uint64 count, bool execute_once);
static void explain_ExecutorFinish(QueryDesc *queryDesc);
static void explain_ExecutorEnd(QueryDesc *queryDesc);
/* index access method interface functions */
extern bool blinsert(Relation index, Datum *values, bool *isnull,
- ItemPointer ht_ctid, Relation heapRel,
- IndexUniqueCheck checkUnique,
- struct IndexInfo *indexInfo);
+ ItemPointer ht_ctid, Relation heapRel,
+ IndexUniqueCheck checkUnique,
+ struct IndexInfo *indexInfo);
extern IndexScanDesc blbeginscan(Relation r, int nkeys, int norderbys);
extern int64 blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
extern void blrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
- ScanKey orderbys, int norderbys);
+ ScanKey orderbys, int norderbys);
extern void blendscan(IndexScanDesc scan);
extern IndexBuildResult *blbuild(Relation heap, Relation index,
- struct IndexInfo *indexInfo);
+ struct IndexInfo *indexInfo);
extern void blbuildempty(Relation index);
extern IndexBulkDeleteResult *blbulkdelete(IndexVacuumInfo *info,
- IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback,
- void *callback_state);
+ IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback,
+ void *callback_state);
extern IndexBulkDeleteResult *blvacuumcleanup(IndexVacuumInfo *info,
- IndexBulkDeleteResult *stats);
+ IndexBulkDeleteResult *stats);
extern bytea *bloptions(Datum reloptions, bool validate);
extern void blcostestimate(PlannerInfo *root, IndexPath *path,
- double loop_count, Cost *indexStartupCost,
- Cost *indexTotalCost, Selectivity *indexSelectivity,
- double *indexCorrelation, double *indexPages);
+ double loop_count, Cost *indexStartupCost,
+ Cost *indexTotalCost, Selectivity *indexSelectivity,
+ double *indexCorrelation, double *indexPages);
#endif
extern Interval *abs_interval(Interval *a);
extern bool gbt_num_consistent(const GBT_NUMKEY_R *key, const void *query,
- const StrategyNumber *strategy, bool is_leaf,
- const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
+ const StrategyNumber *strategy, bool is_leaf,
+ const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern float8 gbt_num_distance(const GBT_NUMKEY_R *key, const void *query,
- bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
+ bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern GIST_SPLITVEC *gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
- const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
+ const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern GISTENTRY *gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo);
extern GISTENTRY *gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo);
extern void *gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec,
- const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
+ const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern bool gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b,
- const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
+ const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
extern void gbt_num_bin_union(Datum *u, GBT_NUMKEY *e,
- const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
+ const gbtree_ninfo *tinfo, FmgrInfo *flinfo);
#endif
extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
- Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
+ Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
- const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
+ const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
- Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
+ Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query,
- StrategyNumber strategy, Oid collation, bool is_leaf,
- const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
+ StrategyNumber strategy, Oid collation, bool is_leaf,
+ const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
extern GIST_SPLITVEC *gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
- Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
+ Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
- const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
+ const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
#endif
static Datum dblink_record_internal(FunctionCallInfo fcinfo, bool is_async);
static void prepTuplestoreResult(FunctionCallInfo fcinfo);
static void materializeResult(FunctionCallInfo fcinfo, PGconn *conn,
- PGresult *res);
+ PGresult *res);
static void materializeQueryResult(FunctionCallInfo fcinfo,
- PGconn *conn,
- const char *conname,
- const char *sql,
- bool fail);
+ PGconn *conn,
+ const char *conname,
+ const char *sql,
+ bool fail);
static PGresult *storeQueryResult(volatile storeInfo *sinfo, PGconn *conn, const char *sql);
static void storeRow(volatile storeInfo *sinfo, PGresult *res, bool first);
static remoteConn *getConnectionByName(const char *name);
static void dblink_connstr_check(const char *connstr);
static void dblink_security_check(PGconn *conn, remoteConn *rconn);
static void dblink_res_error(PGconn *conn, const char *conname, PGresult *res,
- bool fail, const char *fmt,...) pg_attribute_printf(5, 6);
+ bool fail, const char *fmt,...) pg_attribute_printf(5, 6);
static char *get_connect_string(const char *servername);
static char *escape_param_str(const char *from);
static void validate_pkattnums(Relation rel,
- int2vector *pkattnums_arg, int32 pknumatts_arg,
- int **pkattnums, int *pknumatts);
+ int2vector *pkattnums_arg, int32 pknumatts_arg,
+ int **pkattnums, int *pknumatts);
static bool is_valid_dblink_option(const PQconninfoOption *options,
- const char *option, Oid context);
+ const char *option, Oid context);
static int applyRemoteGucs(PGconn *conn);
static void restoreLocalGucs(int nestlevel);
* FDW callback routines
*/
static void fileGetForeignRelSize(PlannerInfo *root,
- RelOptInfo *baserel,
- Oid foreigntableid);
+ RelOptInfo *baserel,
+ Oid foreigntableid);
static void fileGetForeignPaths(PlannerInfo *root,
- RelOptInfo *baserel,
- Oid foreigntableid);
+ RelOptInfo *baserel,
+ Oid foreigntableid);
static ForeignScan *fileGetForeignPlan(PlannerInfo *root,
- RelOptInfo *baserel,
- Oid foreigntableid,
- ForeignPath *best_path,
- List *tlist,
- List *scan_clauses,
- Plan *outer_plan);
+ RelOptInfo *baserel,
+ Oid foreigntableid,
+ ForeignPath *best_path,
+ List *tlist,
+ List *scan_clauses,
+ Plan *outer_plan);
static void fileExplainForeignScan(ForeignScanState *node, ExplainState *es);
static void fileBeginForeignScan(ForeignScanState *node, int eflags);
static TupleTableSlot *fileIterateForeignScan(ForeignScanState *node);
static void fileReScanForeignScan(ForeignScanState *node);
static void fileEndForeignScan(ForeignScanState *node);
static bool fileAnalyzeForeignTable(Relation relation,
- AcquireSampleRowsFunc *func,
- BlockNumber *totalpages);
+ AcquireSampleRowsFunc *func,
+ BlockNumber *totalpages);
static bool fileIsForeignScanParallelSafe(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
/*
* Helper functions
*/
static bool is_valid_option(const char *option, Oid context);
static void fileGetOptions(Oid foreigntableid,
- char **filename,
- bool *is_program,
- List **other_options);
+ char **filename,
+ bool *is_program,
+ List **other_options);
static List *get_file_fdw_attribute_options(Oid relid);
static bool check_selective_binary_conversion(RelOptInfo *baserel,
- Oid foreigntableid,
- List **columns);
+ Oid foreigntableid,
+ List **columns);
static void estimate_size(PlannerInfo *root, RelOptInfo *baserel,
- FileFdwPlanState *fdw_private);
+ FileFdwPlanState *fdw_private);
static void estimate_costs(PlannerInfo *root, RelOptInfo *baserel,
- FileFdwPlanState *fdw_private,
- Cost *startup_cost, Cost *total_cost);
-static int file_acquire_sample_rows(Relation onerel, int elevel,
- HeapTuple *rows, int targrows,
- double *totalrows, double *totaldeadrows);
+ FileFdwPlanState *fdw_private,
+ Cost *startup_cost, Cost *total_cost);
+static int file_acquire_sample_rows(Relation onerel, int elevel,
+ HeapTuple *rows, int targrows,
+ double *totalrows, double *totaldeadrows);
/*
static Selectivity int_query_opr_selec(ITEM *item, Datum *values, float4 *freqs,
- int nmncelems, float4 minfreq);
+ int nmncelems, float4 minfreq);
static int compare_val_int4(const void *a, const void *b);
/*
static PyObject *PLyObject_FromJsonbContainer(JsonbContainer *jsonb);
static JsonbValue *PLyObject_ToJsonbValue(PyObject *obj,
- JsonbParseState **jsonb_state, bool is_elem);
+ JsonbParseState **jsonb_state, bool is_elem);
#if PY_MAJOR_VERSION >= 3
typedef PyObject *(*PLyUnicode_FromStringAndSize_t)
}
bool
- compare_subnode(ltree_level *t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend)
+compare_subnode(ltree_level *t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend)
{
char *endt = t->name + t->len;
char *endq = qn + len;
/* Util function */
Datum ltree_in(PG_FUNCTION_ARGS);
-bool ltree_execute(ITEM *curitem, void *checkval,
- bool calcnot, bool (*chkcond) (void *checkval, ITEM *val));
+bool ltree_execute(ITEM *curitem, void *checkval,
+ bool calcnot, bool (*chkcond) (void *checkval, ITEM *val));
int ltree_compare(const ltree *a, const ltree *b);
bool inner_isparent(const ltree *c, const ltree *p);
-bool compare_subnode(ltree_level *t, char *q, int len,
- int (*cmpptr) (const char *, const char *, size_t), bool anyend);
+bool compare_subnode(ltree_level *t, char *q, int len,
+ int (*cmpptr) (const char *, const char *, size_t), bool anyend);
ltree *lca_inner(ltree **a, int len);
int ltree_strncasecmp(const char *a, const char *b, size_t s);
static Page verify_brin_page(bytea *raw_page, uint16 type,
- const char *strtype);
+ const char *strtype);
Datum
brin_page_type(PG_FUNCTION_ARGS)
PG_MODULE_MAGIC;
static bytea *get_raw_page_internal(text *relname, ForkNumber forknum,
- BlockNumber blkno);
+ BlockNumber blkno);
/*
static void pgss_post_parse_analyze(ParseState *pstate, Query *query);
static void pgss_ExecutorStart(QueryDesc *queryDesc, int eflags);
static void pgss_ExecutorRun(QueryDesc *queryDesc,
- ScanDirection direction,
- uint64 count, bool execute_once);
+ ScanDirection direction,
+ uint64 count, bool execute_once);
static void pgss_ExecutorFinish(QueryDesc *queryDesc);
static void pgss_ExecutorEnd(QueryDesc *queryDesc);
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
- ProcessUtilityContext context, ParamListInfo params,
- QueryEnvironment *queryEnv,
- DestReceiver *dest, char *completionTag);
+ ProcessUtilityContext context, ParamListInfo params,
+ QueryEnvironment *queryEnv,
+ DestReceiver *dest, char *completionTag);
static uint64 pgss_hash_string(const char *str, int len);
static void pgss_store(const char *query, uint64 queryId,
- int query_location, int query_len,
- double total_time, uint64 rows,
- const BufferUsage *bufusage,
- pgssJumbleState *jstate);
+ int query_location, int query_len,
+ double total_time, uint64 rows,
+ const BufferUsage *bufusage,
+ pgssJumbleState *jstate);
static void pg_stat_statements_internal(FunctionCallInfo fcinfo,
- pgssVersion api_version,
- bool showtext);
+ pgssVersion api_version,
+ bool showtext);
static Size pgss_memsize(void);
static pgssEntry *entry_alloc(pgssHashKey *key, Size query_offset, int query_len,
- int encoding, bool sticky);
+ int encoding, bool sticky);
static void entry_dealloc(void);
static bool qtext_store(const char *query, int query_len,
- Size *query_offset, int *gc_count);
+ Size *query_offset, int *gc_count);
static char *qtext_load_file(Size *buffer_size);
static char *qtext_fetch(Size query_offset, int query_len,
- char *buffer, Size buffer_size);
+ char *buffer, Size buffer_size);
static bool need_gc_qtexts(void);
static void gc_qtexts(void);
static void entry_reset(Oid userid, Oid dbid, uint64 queryid);
static void AppendJumble(pgssJumbleState *jstate,
- const unsigned char *item, Size size);
+ const unsigned char *item, Size size);
static void JumbleQuery(pgssJumbleState *jstate, Query *query);
static void JumbleRangeTable(pgssJumbleState *jstate, List *rtable);
static void JumbleExpr(pgssJumbleState *jstate, Node *node);
static void RecordConstLocation(pgssJumbleState *jstate, int location);
static char *generate_normalized_query(pgssJumbleState *jstate, const char *query,
- int query_loc, int *query_len_p, int encoding);
+ int query_loc, int *query_len_p, int encoding);
static void fill_in_constant_lengths(pgssJumbleState *jstate, const char *query,
- int query_loc);
+ int query_loc);
static int comp_location(const void *a, const void *b);
extern bool trgm_contained_by(TRGM *trg1, TRGM *trg2);
extern bool *trgm_presence_map(TRGM *query, TRGM *key);
extern TRGM *createTrgmNFA(text *text_re, Oid collation,
- TrgmPackedGraph **graph, MemoryContext rcontext);
+ TrgmPackedGraph **graph, MemoryContext rcontext);
extern bool trigramsMatchGraph(TrgmPackedGraph *graph, bool *check);
#endif /* __TRGM_H__ */
/* prototypes for private functions */
static TRGM *createTrgmNFAInternal(regex_t *regex, TrgmPackedGraph **graph,
- MemoryContext rcontext);
+ MemoryContext rcontext);
static void RE_compile(regex_t *regex, text *text_re,
- int cflags, Oid collation);
+ int cflags, Oid collation);
static void getColorInfo(regex_t *regex, TrgmNFA *trgmNFA);
static bool convertPgWchar(pg_wchar c, trgm_mb_char *result);
static void transformGraph(TrgmNFA *trgmNFA);
static void addKeyToQueue(TrgmNFA *trgmNFA, TrgmStateKey *key);
static void addArcs(TrgmNFA *trgmNFA, TrgmState *state);
static void addArc(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key,
- TrgmColor co, TrgmStateKey *destKey);
+ TrgmColor co, TrgmStateKey *destKey);
static bool validArcLabel(TrgmStateKey *key, TrgmColor co);
static TrgmState *getState(TrgmNFA *trgmNFA, TrgmStateKey *key);
static bool prefixContains(TrgmPrefix *prefix1, TrgmPrefix *prefix2);
static TupleDesc pg_visibility_tupdesc(bool include_blkno, bool include_pd);
static vbits *collect_visibility_data(Oid relid, bool include_pd);
static corrupt_items *collect_corrupt_items(Oid relid, bool all_visible,
- bool all_frozen);
+ bool all_frozen);
static void record_corrupt_item(corrupt_items *items, ItemPointer tid);
static bool tuple_all_visible(HeapTuple tup, TransactionId OldestXmin,
- Buffer buffer);
+ Buffer buffer);
static void check_relation_relkind(Relation rel);
/*
/* Unsigned magnitude addition; assumes dc is big enough.
Carry out is returned (no memory allocated). */
static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a,
- mp_size size_b);
+ mp_size size_b);
/* Unsigned magnitude subtraction. Assumes dc is big enough. */
static void s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a,
- mp_size size_b);
+ mp_size size_b);
/* Unsigned recursive multiplication. Assumes dc is big enough. */
-static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a,
- mp_size size_b);
+static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a,
+ mp_size size_b);
/* Unsigned magnitude multiplication. Assumes dc is big enough. */
static void s_umul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a,
- mp_size size_b);
+ mp_size size_b);
/* Unsigned recursive squaring. Assumes dc is big enough. */
static int s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a);
/*
* Push filter
*/
-int pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg,
- PushFilter *next);
+int pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg,
+ PushFilter *next);
int pushf_write(PushFilter *mp, const uint8 *data, int len);
void pushf_free_all(PushFilter *mp);
void pushf_free(PushFilter *mp);
/*
* Pull filter
*/
-int pullf_create(PullFilter **res, const PullFilterOps *ops,
- void *init_arg, PullFilter *src);
+int pullf_create(PullFilter **res, const PullFilterOps *ops,
+ void *init_arg, PullFilter *src);
int pullf_read(PullFilter *mp, int len, uint8 **data_p);
-int pullf_read_max(PullFilter *mp, int len,
- uint8 **data_p, uint8 *tmpbuf);
+int pullf_read_max(PullFilter *mp, int len,
+ uint8 **data_p, uint8 *tmpbuf);
void pullf_free(PullFilter *mp);
int pullf_read_fixed(PullFilter *src, int len, uint8 *dst);
}
/* process_data_packets and parse_compressed_data call each other */
-static int process_data_packets(PGP_Context *ctx, MBuf *dst,
- PullFilter *src, int allow_compr, int need_mdc);
+static int process_data_packets(PGP_Context *ctx, MBuf *dst,
+ PullFilter *src, int allow_compr, int need_mdc);
static int
parse_compressed_data(PGP_Context *ctx, MBuf *dst, PullFilter *pkt)