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)
int pgp_get_unicode_mode(PGP_Context *ctx);
int pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int klen);
-int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt,
- const uint8 *key, int klen, int pubtype);
+int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt,
+ const uint8 *key, int klen, int pubtype);
int pgp_get_keyid(MBuf *pgp_data, char *dst);
int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen);
typedef struct PGP_CFB PGP_CFB;
-int pgp_cfb_create(PGP_CFB **ctx_p, int algo,
- const uint8 *key, int key_len, int recync, uint8 *iv);
+int pgp_cfb_create(PGP_CFB **ctx_p, int algo,
+ const uint8 *key, int key_len, int recync, uint8 *iv);
void pgp_cfb_free(PGP_CFB *ctx);
int pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst);
int pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst);
-void pgp_armor_encode(const uint8 *src, unsigned len, StringInfo dst,
- int num_headers, char **keys, char **values);
+void pgp_armor_encode(const uint8 *src, unsigned len, StringInfo dst,
+ int num_headers, char **keys, char **values);
int pgp_armor_decode(const uint8 *src, int len, StringInfo dst);
-int pgp_extract_armor_headers(const uint8 *src, unsigned len,
- int *nheaders, char ***keys, char ***values);
+int pgp_extract_armor_headers(const uint8 *src, unsigned len,
+ int *nheaders, char ***keys, char ***values);
int pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst);
int pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src);
int _pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p);
int pgp_parse_pubenc_sesskey(PGP_Context *ctx, PullFilter *pkt);
-int pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len,
- int pkttype, PGP_Context *ctx);
-int pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p,
- int allow_ctx);
+int pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len,
+ int pkttype, PGP_Context *ctx);
+int pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p,
+ int allow_ctx);
int pgp_skip_packet(PullFilter *pkt);
int pgp_expect_packet_end(PullFilter *pkt);
int pgp_mpi_hash(PX_MD *md, PGP_MPI *n);
unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI *n);
-int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m,
- PGP_MPI **c1, PGP_MPI **c2);
-int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2,
- PGP_MPI **m);
+int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m,
+ PGP_MPI **c1, PGP_MPI **c2);
+int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2,
+ PGP_MPI **m);
int pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *m, PGP_MPI **c);
int pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *c, PGP_MPI **m);
*/
/* crypt-gensalt.c */
-char *_crypt_gensalt_traditional_rn(unsigned long count,
- const char *input, int size, char *output, int output_size);
-char *_crypt_gensalt_extended_rn(unsigned long count,
- const char *input, int size, char *output, int output_size);
-char *_crypt_gensalt_md5_rn(unsigned long count,
- const char *input, int size, char *output, int output_size);
-char *_crypt_gensalt_blowfish_rn(unsigned long count,
- const char *input, int size, char *output, int output_size);
+char *_crypt_gensalt_traditional_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size);
+char *_crypt_gensalt_extended_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size);
+char *_crypt_gensalt_md5_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size);
+char *_crypt_gensalt_blowfish_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size);
/* disable 'extended DES crypt' */
/* #define DISABLE_XDES */
/* crypt-blowfish.c */
-char *_crypt_blowfish_rn(const char *key, const char *setting,
- char *output, int size);
+char *_crypt_blowfish_rn(const char *key, const char *setting,
+ char *output, int size);
/* crypt-des.c */
char *px_crypt_des(const char *key, const char *setting);
/* crypt-md5.c */
-char *px_crypt_md5(const char *pw, const char *salt,
- char *dst, unsigned dstlen);
+char *px_crypt_md5(const char *pw, const char *salt,
+ char *dst, unsigned dstlen);
#endif /* _PX_CRYPT_H */
BufferAccessStrategy);
static Datum build_pgstattuple_type(pgstattuple_type *stat,
- FunctionCallInfo fcinfo);
+ FunctionCallInfo fcinfo);
static Datum pgstat_relation(Relation rel, FunctionCallInfo fcinfo);
static Datum pgstat_heap(Relation rel, FunctionCallInfo fcinfo);
static void pgstat_btree_page(pgstattuple_type *stat,
- Relation rel, BlockNumber blkno,
- BufferAccessStrategy bstrategy);
+ Relation rel, BlockNumber blkno,
+ BufferAccessStrategy bstrategy);
static void pgstat_hash_page(pgstattuple_type *stat,
- Relation rel, BlockNumber blkno,
- BufferAccessStrategy bstrategy);
+ Relation rel, BlockNumber blkno,
+ BufferAccessStrategy bstrategy);
static void pgstat_gist_page(pgstattuple_type *stat,
- Relation rel, BlockNumber blkno,
- BufferAccessStrategy bstrategy);
+ Relation rel, BlockNumber blkno,
+ BufferAccessStrategy bstrategy);
static Datum pgstat_index(Relation rel, BlockNumber start,
- pgstat_page pagefn, FunctionCallInfo fcinfo);
+ pgstat_page pagefn, FunctionCallInfo fcinfo);
static void pgstat_index_page(pgstattuple_type *stat, Page page,
- OffsetNumber minoff, OffsetNumber maxoff);
+ OffsetNumber minoff, OffsetNumber maxoff);
/*
* build_pgstattuple_type -- build a pgstattuple_type tuple
static void begin_remote_xact(ConnCacheEntry *entry);
static void pgfdw_xact_callback(XactEvent event, void *arg);
static void pgfdw_subxact_callback(SubXactEvent event,
- SubTransactionId mySubid,
- SubTransactionId parentSubid,
- void *arg);
+ SubTransactionId mySubid,
+ SubTransactionId parentSubid,
+ void *arg);
static void pgfdw_inval_callback(Datum arg, int cacheid, uint32 hashvalue);
static void pgfdw_reject_incomplete_xact_state_change(ConnCacheEntry *entry);
static bool pgfdw_cancel_query(PGconn *conn);
static bool pgfdw_exec_cleanup_query(PGconn *conn, const char *query,
- bool ignore_errors);
+ bool ignore_errors);
static bool pgfdw_get_cleanup_result(PGconn *conn, TimestampTz endtime,
- PGresult **result);
+ PGresult **result);
/*
* remote server.
*/
static bool foreign_expr_walker(Node *node,
- foreign_glob_cxt *glob_cxt,
- foreign_loc_cxt *outer_cxt);
+ foreign_glob_cxt *glob_cxt,
+ foreign_loc_cxt *outer_cxt);
static char *deparse_type_name(Oid type_oid, int32 typemod);
/*
* Functions to construct string representation of a node tree.
*/
static void deparseTargetList(StringInfo buf,
- RangeTblEntry *rte,
- Index rtindex,
- Relation rel,
- bool is_returning,
- Bitmapset *attrs_used,
- bool qualify_col,
- List **retrieved_attrs);
+ RangeTblEntry *rte,
+ Index rtindex,
+ Relation rel,
+ bool is_returning,
+ Bitmapset *attrs_used,
+ bool qualify_col,
+ List **retrieved_attrs);
static void deparseExplicitTargetList(List *tlist,
- bool is_returning,
- List **retrieved_attrs,
- deparse_expr_cxt *context);
+ bool is_returning,
+ List **retrieved_attrs,
+ deparse_expr_cxt *context);
static void deparseSubqueryTargetList(deparse_expr_cxt *context);
static void deparseReturningList(StringInfo buf, RangeTblEntry *rte,
- Index rtindex, Relation rel,
- bool trig_after_row,
- List *withCheckOptionList,
- List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ bool trig_after_row,
+ List *withCheckOptionList,
+ List *returningList,
+ List **retrieved_attrs);
static void deparseColumnRef(StringInfo buf, int varno, int varattno,
- RangeTblEntry *rte, bool qualify_col);
+ RangeTblEntry *rte, bool qualify_col);
static void deparseRelation(StringInfo buf, Relation rel);
static void deparseExpr(Expr *expr, deparse_expr_cxt *context);
static void deparseVar(Var *node, deparse_expr_cxt *context);
static void deparseOperatorName(StringInfo buf, Form_pg_operator opform);
static void deparseDistinctExpr(DistinctExpr *node, deparse_expr_cxt *context);
static void deparseScalarArrayOpExpr(ScalarArrayOpExpr *node,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
static void deparseRelabelType(RelabelType *node, deparse_expr_cxt *context);
static void deparseBoolExpr(BoolExpr *node, deparse_expr_cxt *context);
static void deparseNullTest(NullTest *node, deparse_expr_cxt *context);
static void deparseArrayExpr(ArrayExpr *node, deparse_expr_cxt *context);
static void printRemoteParam(int paramindex, Oid paramtype, int32 paramtypmod,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
static void printRemotePlaceholder(Oid paramtype, int32 paramtypmod,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
static void deparseSelectSql(List *tlist, bool is_subquery, List **retrieved_attrs,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
static void deparseLockingClause(deparse_expr_cxt *context);
static void appendOrderByClause(List *pathkeys, bool has_final_sort,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
static void appendLimitClause(deparse_expr_cxt *context);
static void appendConditions(List *exprs, deparse_expr_cxt *context);
static void deparseFromExprForRel(StringInfo buf, PlannerInfo *root,
- RelOptInfo *foreignrel, bool use_alias,
- Index ignore_rel, List **ignore_conds,
- List **params_list);
+ RelOptInfo *foreignrel, bool use_alias,
+ Index ignore_rel, List **ignore_conds,
+ List **params_list);
static void deparseFromExpr(List *quals, deparse_expr_cxt *context);
static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root,
- RelOptInfo *foreignrel, bool make_subquery,
- Index ignore_rel, List **ignore_conds, List **params_list);
+ RelOptInfo *foreignrel, bool make_subquery,
+ Index ignore_rel, List **ignore_conds, List **params_list);
static void deparseAggref(Aggref *node, deparse_expr_cxt *context);
static void appendGroupByClause(List *tlist, deparse_expr_cxt *context);
static void appendAggOrderBy(List *orderList, List *targetList,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
static void appendFunctionName(Oid funcid, deparse_expr_cxt *context);
static Node *deparseSortGroupClause(Index ref, List *tlist, bool force_colno,
- deparse_expr_cxt *context);
+ deparse_expr_cxt *context);
/*
* Helper functions
*/
static bool is_subquery_var(Var *node, RelOptInfo *foreignrel,
- int *relno, int *colno);
+ int *relno, int *colno);
static void get_relation_column_alias_ids(Var *node, RelOptInfo *foreignrel,
- int *relno, int *colno);
+ int *relno, int *colno);
/*
* FDW callback routines
*/
static void postgresGetForeignRelSize(PlannerInfo *root,
- RelOptInfo *baserel,
- Oid foreigntableid);
+ RelOptInfo *baserel,
+ Oid foreigntableid);
static void postgresGetForeignPaths(PlannerInfo *root,
- RelOptInfo *baserel,
- Oid foreigntableid);
+ RelOptInfo *baserel,
+ Oid foreigntableid);
static ForeignScan *postgresGetForeignPlan(PlannerInfo *root,
- RelOptInfo *foreignrel,
- Oid foreigntableid,
- ForeignPath *best_path,
- List *tlist,
- List *scan_clauses,
- Plan *outer_plan);
+ RelOptInfo *foreignrel,
+ Oid foreigntableid,
+ ForeignPath *best_path,
+ List *tlist,
+ List *scan_clauses,
+ Plan *outer_plan);
static void postgresBeginForeignScan(ForeignScanState *node, int eflags);
static TupleTableSlot *postgresIterateForeignScan(ForeignScanState *node);
static void postgresReScanForeignScan(ForeignScanState *node);
static void postgresEndForeignScan(ForeignScanState *node);
static void postgresAddForeignUpdateTargets(Query *parsetree,
- RangeTblEntry *target_rte,
- Relation target_relation);
+ RangeTblEntry *target_rte,
+ Relation target_relation);
static List *postgresPlanForeignModify(PlannerInfo *root,
- ModifyTable *plan,
- Index resultRelation,
- int subplan_index);
+ ModifyTable *plan,
+ Index resultRelation,
+ int subplan_index);
static void postgresBeginForeignModify(ModifyTableState *mtstate,
- ResultRelInfo *resultRelInfo,
- List *fdw_private,
- int subplan_index,
- int eflags);
+ ResultRelInfo *resultRelInfo,
+ List *fdw_private,
+ int subplan_index,
+ int eflags);
static TupleTableSlot *postgresExecForeignInsert(EState *estate,
- ResultRelInfo *resultRelInfo,
- TupleTableSlot *slot,
- TupleTableSlot *planSlot);
+ ResultRelInfo *resultRelInfo,
+ TupleTableSlot *slot,
+ TupleTableSlot *planSlot);
static TupleTableSlot *postgresExecForeignUpdate(EState *estate,
- ResultRelInfo *resultRelInfo,
- TupleTableSlot *slot,
- TupleTableSlot *planSlot);
+ ResultRelInfo *resultRelInfo,
+ TupleTableSlot *slot,
+ TupleTableSlot *planSlot);
static TupleTableSlot *postgresExecForeignDelete(EState *estate,
- ResultRelInfo *resultRelInfo,
- TupleTableSlot *slot,
- TupleTableSlot *planSlot);
+ ResultRelInfo *resultRelInfo,
+ TupleTableSlot *slot,
+ TupleTableSlot *planSlot);
static void postgresEndForeignModify(EState *estate,
- ResultRelInfo *resultRelInfo);
+ ResultRelInfo *resultRelInfo);
static void postgresBeginForeignInsert(ModifyTableState *mtstate,
- ResultRelInfo *resultRelInfo);
+ ResultRelInfo *resultRelInfo);
static void postgresEndForeignInsert(EState *estate,
- ResultRelInfo *resultRelInfo);
+ ResultRelInfo *resultRelInfo);
static int postgresIsForeignRelUpdatable(Relation rel);
static bool postgresPlanDirectModify(PlannerInfo *root,
- ModifyTable *plan,
- Index resultRelation,
- int subplan_index);
+ ModifyTable *plan,
+ Index resultRelation,
+ int subplan_index);
static void postgresBeginDirectModify(ForeignScanState *node, int eflags);
static TupleTableSlot *postgresIterateDirectModify(ForeignScanState *node);
static void postgresEndDirectModify(ForeignScanState *node);
static void postgresExplainForeignScan(ForeignScanState *node,
- ExplainState *es);
+ ExplainState *es);
static void postgresExplainForeignModify(ModifyTableState *mtstate,
- ResultRelInfo *rinfo,
- List *fdw_private,
- int subplan_index,
- ExplainState *es);
+ ResultRelInfo *rinfo,
+ List *fdw_private,
+ int subplan_index,
+ ExplainState *es);
static void postgresExplainDirectModify(ForeignScanState *node,
- ExplainState *es);
+ ExplainState *es);
static bool postgresAnalyzeForeignTable(Relation relation,
- AcquireSampleRowsFunc *func,
- BlockNumber *totalpages);
+ AcquireSampleRowsFunc *func,
+ BlockNumber *totalpages);
static List *postgresImportForeignSchema(ImportForeignSchemaStmt *stmt,
- Oid serverOid);
+ Oid serverOid);
static void postgresGetForeignJoinPaths(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *outerrel,
- RelOptInfo *innerrel,
- JoinType jointype,
- JoinPathExtraData *extra);
+ RelOptInfo *joinrel,
+ RelOptInfo *outerrel,
+ RelOptInfo *innerrel,
+ JoinType jointype,
+ JoinPathExtraData *extra);
static bool postgresRecheckForeignScan(ForeignScanState *node,
- TupleTableSlot *slot);
+ TupleTableSlot *slot);
static void postgresGetForeignUpperPaths(PlannerInfo *root,
- UpperRelationKind stage,
- RelOptInfo *input_rel,
- RelOptInfo *output_rel,
- void *extra);
+ UpperRelationKind stage,
+ RelOptInfo *input_rel,
+ RelOptInfo *output_rel,
+ void *extra);
/*
* Helper functions
*/
static void estimate_path_cost_size(PlannerInfo *root,
- RelOptInfo *foreignrel,
- List *param_join_conds,
- List *pathkeys,
- PgFdwPathExtraData *fpextra,
- double *p_rows, int *p_width,
- Cost *p_startup_cost, Cost *p_total_cost);
+ RelOptInfo *foreignrel,
+ List *param_join_conds,
+ List *pathkeys,
+ PgFdwPathExtraData *fpextra,
+ double *p_rows, int *p_width,
+ Cost *p_startup_cost, Cost *p_total_cost);
static void get_remote_estimate(const char *sql,
- PGconn *conn,
- double *rows,
- int *width,
- Cost *startup_cost,
- Cost *total_cost);
+ PGconn *conn,
+ double *rows,
+ int *width,
+ Cost *startup_cost,
+ Cost *total_cost);
static void adjust_foreign_grouping_path_cost(PlannerInfo *root,
- List *pathkeys,
- double retrieved_rows,
- double width,
- double limit_tuples,
- Cost *p_startup_cost,
- Cost *p_run_cost);
+ List *pathkeys,
+ double retrieved_rows,
+ double width,
+ double limit_tuples,
+ Cost *p_startup_cost,
+ Cost *p_run_cost);
static bool ec_member_matches_foreign(PlannerInfo *root, RelOptInfo *rel,
- EquivalenceClass *ec, EquivalenceMember *em,
- void *arg);
+ EquivalenceClass *ec, EquivalenceMember *em,
+ void *arg);
static void create_cursor(ForeignScanState *node);
static void fetch_more_data(ForeignScanState *node);
static void close_cursor(PGconn *conn, unsigned int cursor_number);
static PgFdwModifyState *create_foreign_modify(EState *estate,
- RangeTblEntry *rte,
- ResultRelInfo *resultRelInfo,
- CmdType operation,
- Plan *subplan,
- char *query,
- List *target_attrs,
- bool has_returning,
- List *retrieved_attrs);
+ RangeTblEntry *rte,
+ ResultRelInfo *resultRelInfo,
+ CmdType operation,
+ Plan *subplan,
+ char *query,
+ List *target_attrs,
+ bool has_returning,
+ List *retrieved_attrs);
static TupleTableSlot *execute_foreign_modify(EState *estate,
- ResultRelInfo *resultRelInfo,
- CmdType operation,
- TupleTableSlot *slot,
- TupleTableSlot *planSlot);
+ ResultRelInfo *resultRelInfo,
+ CmdType operation,
+ TupleTableSlot *slot,
+ TupleTableSlot *planSlot);
static void prepare_foreign_modify(PgFdwModifyState *fmstate);
static const char **convert_prep_stmt_params(PgFdwModifyState *fmstate,
- ItemPointer tupleid,
- TupleTableSlot *slot);
+ ItemPointer tupleid,
+ TupleTableSlot *slot);
static void store_returning_result(PgFdwModifyState *fmstate,
- TupleTableSlot *slot, PGresult *res);
+ TupleTableSlot *slot, PGresult *res);
static void finish_foreign_modify(PgFdwModifyState *fmstate);
static List *build_remote_returning(Index rtindex, Relation rel,
- List *returningList);
+ List *returningList);
static void rebuild_fdw_scan_tlist(ForeignScan *fscan, List *tlist);
static void execute_dml_stmt(ForeignScanState *node);
static TupleTableSlot *get_returning_data(ForeignScanState *node);
static void init_returning_filter(PgFdwDirectModifyState *dmstate,
- List *fdw_scan_tlist,
- Index rtindex);
+ List *fdw_scan_tlist,
+ Index rtindex);
static TupleTableSlot *apply_returning_filter(PgFdwDirectModifyState *dmstate,
- TupleTableSlot *slot,
- EState *estate);
+ TupleTableSlot *slot,
+ EState *estate);
static void prepare_query_params(PlanState *node,
- List *fdw_exprs,
- int numParams,
- FmgrInfo **param_flinfo,
- List **param_exprs,
- const char ***param_values);
+ List *fdw_exprs,
+ int numParams,
+ FmgrInfo **param_flinfo,
+ List **param_exprs,
+ const char ***param_values);
static void process_query_params(ExprContext *econtext,
- FmgrInfo *param_flinfo,
- List *param_exprs,
- const char **param_values);
-static int postgresAcquireSampleRowsFunc(Relation relation, int elevel,
- HeapTuple *rows, int targrows,
- double *totalrows,
- double *totaldeadrows);
+ FmgrInfo *param_flinfo,
+ List *param_exprs,
+ const char **param_values);
+static int postgresAcquireSampleRowsFunc(Relation relation, int elevel,
+ HeapTuple *rows, int targrows,
+ double *totalrows,
+ double *totaldeadrows);
static void analyze_row_processor(PGresult *res, int row,
- PgFdwAnalyzeState *astate);
+ PgFdwAnalyzeState *astate);
static HeapTuple make_tuple_from_result_row(PGresult *res,
- int row,
- Relation rel,
- AttInMetadata *attinmeta,
- List *retrieved_attrs,
- ForeignScanState *fsstate,
- MemoryContext temp_context);
+ int row,
+ Relation rel,
+ AttInMetadata *attinmeta,
+ List *retrieved_attrs,
+ ForeignScanState *fsstate,
+ MemoryContext temp_context);
static void conversion_error_callback(void *arg);
static bool foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel,
- JoinType jointype, RelOptInfo *outerrel, RelOptInfo *innerrel,
- JoinPathExtraData *extra);
+ JoinType jointype, RelOptInfo *outerrel, RelOptInfo *innerrel,
+ JoinPathExtraData *extra);
static bool foreign_grouping_ok(PlannerInfo *root, RelOptInfo *grouped_rel,
- Node *havingQual);
+ Node *havingQual);
static List *get_useful_pathkeys_for_relation(PlannerInfo *root,
- RelOptInfo *rel);
+ RelOptInfo *rel);
static List *get_useful_ecs_for_relation(PlannerInfo *root, RelOptInfo *rel);
static void add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel,
- Path *epq_path);
+ Path *epq_path);
static void add_foreign_grouping_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- RelOptInfo *grouped_rel,
- GroupPathExtraData *extra);
+ RelOptInfo *input_rel,
+ RelOptInfo *grouped_rel,
+ GroupPathExtraData *extra);
static void add_foreign_ordered_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- RelOptInfo *ordered_rel);
+ RelOptInfo *input_rel,
+ RelOptInfo *ordered_rel);
static void add_foreign_final_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- RelOptInfo *final_rel,
- FinalPathExtraData *extra);
+ RelOptInfo *input_rel,
+ RelOptInfo *final_rel,
+ FinalPathExtraData *extra);
static void apply_server_options(PgFdwRelationInfo *fpinfo);
static void apply_table_options(PgFdwRelationInfo *fpinfo);
static void merge_fdw_options(PgFdwRelationInfo *fpinfo,
- const PgFdwRelationInfo *fpinfo_o,
- const PgFdwRelationInfo *fpinfo_i);
+ const PgFdwRelationInfo *fpinfo_o,
+ const PgFdwRelationInfo *fpinfo_i);
/*
extern PGresult *pgfdw_get_result(PGconn *conn, const char *query);
extern PGresult *pgfdw_exec_query(PGconn *conn, const char *query);
extern void pgfdw_report_error(int elevel, PGresult *res, PGconn *conn,
- bool clear, const char *sql);
+ bool clear, const char *sql);
/* in option.c */
-extern int ExtractConnectionOptions(List *defelems,
- const char **keywords,
- const char **values);
+extern int ExtractConnectionOptions(List *defelems,
+ const char **keywords,
+ const char **values);
extern List *ExtractExtensionList(const char *extensionsString,
- bool warnOnMissing);
+ bool warnOnMissing);
/* in deparse.c */
extern void classifyConditions(PlannerInfo *root,
- RelOptInfo *baserel,
- List *input_conds,
- List **remote_conds,
- List **local_conds);
+ RelOptInfo *baserel,
+ List *input_conds,
+ List **remote_conds,
+ List **local_conds);
extern bool is_foreign_expr(PlannerInfo *root,
- RelOptInfo *baserel,
- Expr *expr);
+ RelOptInfo *baserel,
+ Expr *expr);
extern bool is_foreign_param(PlannerInfo *root,
- RelOptInfo *baserel,
- Expr *expr);
+ RelOptInfo *baserel,
+ Expr *expr);
extern void deparseInsertSql(StringInfo buf, RangeTblEntry *rte,
- Index rtindex, Relation rel,
- List *targetAttrs, bool doNothing,
- List *withCheckOptionList, List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ List *targetAttrs, bool doNothing,
+ List *withCheckOptionList, List *returningList,
+ List **retrieved_attrs);
extern void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte,
- Index rtindex, Relation rel,
- List *targetAttrs,
- List *withCheckOptionList, List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ List *targetAttrs,
+ List *withCheckOptionList, List *returningList,
+ List **retrieved_attrs);
extern void deparseDirectUpdateSql(StringInfo buf, PlannerInfo *root,
- Index rtindex, Relation rel,
- RelOptInfo *foreignrel,
- List *targetlist,
- List *targetAttrs,
- List *remote_conds,
- List **params_list,
- List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ RelOptInfo *foreignrel,
+ List *targetlist,
+ List *targetAttrs,
+ List *remote_conds,
+ List **params_list,
+ List *returningList,
+ List **retrieved_attrs);
extern void deparseDeleteSql(StringInfo buf, RangeTblEntry *rte,
- Index rtindex, Relation rel,
- List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ List *returningList,
+ List **retrieved_attrs);
extern void deparseDirectDeleteSql(StringInfo buf, PlannerInfo *root,
- Index rtindex, Relation rel,
- RelOptInfo *foreignrel,
- List *remote_conds,
- List **params_list,
- List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ RelOptInfo *foreignrel,
+ List *remote_conds,
+ List **params_list,
+ List *returningList,
+ List **retrieved_attrs);
extern void deparseAnalyzeSizeSql(StringInfo buf, Relation rel);
extern void deparseAnalyzeSql(StringInfo buf, Relation rel,
- List **retrieved_attrs);
+ List **retrieved_attrs);
extern void deparseStringLiteral(StringInfo buf, const char *val);
extern Expr *find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel);
extern Expr *find_em_expr_for_input_target(PlannerInfo *root,
- EquivalenceClass *ec,
- PathTarget *target);
+ EquivalenceClass *ec,
+ PathTarget *target);
extern List *build_tlist_to_deparse(RelOptInfo *foreignrel);
extern void deparseSelectStmtForRel(StringInfo buf, PlannerInfo *root,
- RelOptInfo *foreignrel, List *tlist,
- List *remote_conds, List *pathkeys,
- bool has_final_sort, bool has_limit,
- bool is_subquery,
- List **retrieved_attrs, List **params_list);
+ RelOptInfo *foreignrel, List *tlist,
+ List *remote_conds, List *pathkeys,
+ bool has_final_sort, bool has_limit,
+ bool is_subquery,
+ List **retrieved_attrs, List **params_list);
extern const char *get_jointype_name(JoinType jointype);
/* in shippable.c */
extern bool sepgsql_getenforce(void);
extern void sepgsql_audit_log(bool denied,
- const char *scontext,
- const char *tcontext,
- uint16 tclass,
- uint32 audited,
- const char *audit_name);
+ const char *scontext,
+ const char *tcontext,
+ uint16 tclass,
+ uint32 audited,
+ const char *audit_name);
extern void sepgsql_compute_avd(const char *scontext,
- const char *tcontext,
- uint16 tclass,
- struct av_decision *avd);
+ const char *tcontext,
+ uint16 tclass,
+ struct av_decision *avd);
extern char *sepgsql_compute_create(const char *scontext,
- const char *tcontext,
- uint16 tclass,
- const char *objname);
+ const char *tcontext,
+ uint16 tclass,
+ const char *objname);
extern bool sepgsql_check_perms(const char *scontext,
- const char *tcontext,
- uint16 tclass,
- uint32 required,
- const char *audit_name,
- bool abort_on_violation);
+ const char *tcontext,
+ uint16 tclass,
+ uint32 required,
+ const char *audit_name,
+ bool abort_on_violation);
/*
* uavc.c
*/
#define SEPGSQL_AVC_NOAUDIT ((void *)(-1))
extern bool sepgsql_avc_check_perms_label(const char *tcontext,
- uint16 tclass,
- uint32 required,
- const char *audit_name,
- bool abort_on_violation);
+ uint16 tclass,
+ uint32 required,
+ const char *audit_name,
+ bool abort_on_violation);
extern bool sepgsql_avc_check_perms(const ObjectAddress *tobject,
- uint16 tclass,
- uint32 required,
- const char *audit_name,
- bool abort_on_violation);
+ uint16 tclass,
+ uint32 required,
+ const char *audit_name,
+ bool abort_on_violation);
extern char *sepgsql_avc_trusted_proc(Oid functionId);
extern void sepgsql_avc_init(void);
extern char *sepgsql_get_label(Oid relOid, Oid objOid, int32 subId);
extern void sepgsql_object_relabel(const ObjectAddress *object,
- const char *seclabel);
+ const char *seclabel);
/*
* dml.c
* database.c
*/
extern void sepgsql_database_post_create(Oid databaseId,
- const char *dtemplate);
+ const char *dtemplate);
extern void sepgsql_database_drop(Oid databaseId);
extern void sepgsql_database_relabel(Oid databaseId, const char *seclabel);
extern void sepgsql_database_setattr(Oid databaseId);
extern void sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum);
extern void sepgsql_attribute_drop(Oid relOid, AttrNumber attnum);
extern void sepgsql_attribute_relabel(Oid relOid, AttrNumber attnum,
- const char *seclabel);
+ const char *seclabel);
extern void sepgsql_attribute_setattr(Oid relOid, AttrNumber attnum);
extern void sepgsql_relation_post_create(Oid relOid);
extern void sepgsql_relation_drop(Oid relOid);
static HTAB *load_categories_hash(char *cats_sql, MemoryContext per_query_ctx);
static Tuplestorestate *get_crosstab_tuplestore(char *sql,
- HTAB *crosstab_hash,
- TupleDesc tupdesc,
- MemoryContext per_query_ctx,
- bool randomAccess);
+ HTAB *crosstab_hash,
+ TupleDesc tupdesc,
+ MemoryContext per_query_ctx,
+ bool randomAccess);
static void validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool show_serial);
static bool compatCrosstabTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
static void compatConnectbyTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
static void get_normal_pair(float8 *x1, float8 *x2);
static Tuplestorestate *connectby(char *relname,
- char *key_fld,
- char *parent_key_fld,
- char *orderby_fld,
- char *branch_delim,
- char *start_with,
- int max_depth,
- bool show_branch,
- bool show_serial,
- MemoryContext per_query_ctx,
- bool randomAccess,
- AttInMetadata *attinmeta);
+ char *key_fld,
+ char *parent_key_fld,
+ char *orderby_fld,
+ char *branch_delim,
+ char *start_with,
+ int max_depth,
+ bool show_branch,
+ bool show_serial,
+ MemoryContext per_query_ctx,
+ bool randomAccess,
+ AttInMetadata *attinmeta);
static void build_tuplestore_recursively(char *key_fld,
- char *parent_key_fld,
- char *relname,
- char *orderby_fld,
- char *branch_delim,
- char *start_with,
- char *branch,
- int level,
- int *serial,
- int max_depth,
- bool show_branch,
- bool show_serial,
- MemoryContext per_query_ctx,
- AttInMetadata *attinmeta,
- Tuplestorestate *tupstore);
+ char *parent_key_fld,
+ char *relname,
+ char *orderby_fld,
+ char *branch_delim,
+ char *start_with,
+ char *branch,
+ int level,
+ int *serial,
+ int max_depth,
+ bool show_branch,
+ bool show_serial,
+ MemoryContext per_query_ctx,
+ AttInMetadata *attinmeta,
+ Tuplestorestate *tupstore);
typedef struct
{
} TestDecodingData;
static void pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
- bool is_init);
+ bool is_init);
static void pg_decode_shutdown(LogicalDecodingContext *ctx);
static void pg_decode_begin_txn(LogicalDecodingContext *ctx,
- ReorderBufferTXN *txn);
+ ReorderBufferTXN *txn);
static void pg_output_begin(LogicalDecodingContext *ctx,
- TestDecodingData *data,
- ReorderBufferTXN *txn,
- bool last_write);
+ TestDecodingData *data,
+ ReorderBufferTXN *txn,
+ bool last_write);
static void pg_decode_commit_txn(LogicalDecodingContext *ctx,
- ReorderBufferTXN *txn, XLogRecPtr commit_lsn);
+ ReorderBufferTXN *txn, XLogRecPtr commit_lsn);
static void pg_decode_change(LogicalDecodingContext *ctx,
- ReorderBufferTXN *txn, Relation rel,
- ReorderBufferChange *change);
+ ReorderBufferTXN *txn, Relation rel,
+ ReorderBufferChange *change);
static void pg_decode_truncate(LogicalDecodingContext *ctx,
- ReorderBufferTXN *txn,
- int nrelations, Relation relations[],
- ReorderBufferChange *change);
+ ReorderBufferTXN *txn,
+ int nrelations, Relation relations[],
+ ReorderBufferChange *change);
static bool pg_decode_filter(LogicalDecodingContext *ctx,
- RepOriginId origin_id);
+ RepOriginId origin_id);
static void pg_decode_message(LogicalDecodingContext *ctx,
- ReorderBufferTXN *txn, XLogRecPtr message_lsn,
- bool transactional, const char *prefix,
- Size sz, const char *message);
+ ReorderBufferTXN *txn, XLogRecPtr message_lsn,
+ bool transactional, const char *prefix,
+ Size sz, const char *message);
void
_PG_init(void)
} SystemRowsSamplerData;
static void system_rows_samplescangetsamplesize(PlannerInfo *root,
- RelOptInfo *baserel,
- List *paramexprs,
- BlockNumber *pages,
- double *tuples);
+ RelOptInfo *baserel,
+ List *paramexprs,
+ BlockNumber *pages,
+ double *tuples);
static void system_rows_initsamplescan(SampleScanState *node,
- int eflags);
+ int eflags);
static void system_rows_beginsamplescan(SampleScanState *node,
- Datum *params,
- int nparams,
- uint32 seed);
+ Datum *params,
+ int nparams,
+ uint32 seed);
static BlockNumber system_rows_nextsampleblock(SampleScanState *node, BlockNumber nblocks);
static OffsetNumber system_rows_nextsampletuple(SampleScanState *node,
- BlockNumber blockno,
- OffsetNumber maxoffset);
+ BlockNumber blockno,
+ OffsetNumber maxoffset);
static uint32 random_relative_prime(uint32 n, SamplerRandomState randstate);
} SystemTimeSamplerData;
static void system_time_samplescangetsamplesize(PlannerInfo *root,
- RelOptInfo *baserel,
- List *paramexprs,
- BlockNumber *pages,
- double *tuples);
+ RelOptInfo *baserel,
+ List *paramexprs,
+ BlockNumber *pages,
+ double *tuples);
static void system_time_initsamplescan(SampleScanState *node,
- int eflags);
+ int eflags);
static void system_time_beginsamplescan(SampleScanState *node,
- Datum *params,
- int nparams,
- uint32 seed);
+ Datum *params,
+ int nparams,
+ uint32 seed);
static BlockNumber system_time_nextsampleblock(SampleScanState *node, BlockNumber nblocks);
static OffsetNumber system_time_nextsampletuple(SampleScanState *node,
- BlockNumber blockno,
- OffsetNumber maxoffset);
+ BlockNumber blockno,
+ OffsetNumber maxoffset);
static uint32 random_relative_prime(uint32 n, SamplerRandomState randstate);
/* local declarations */
static xmlChar *pgxmlNodeSetToText(xmlNodeSetPtr nodeset,
- xmlChar *toptagname, xmlChar *septagname,
- xmlChar *plainsep);
+ xmlChar *toptagname, xmlChar *septagname,
+ xmlChar *plainsep);
static text *pgxml_result_to_text(xmlXPathObjectPtr res, xmlChar *toptag,
- xmlChar *septag, xmlChar *plainsep);
+ xmlChar *septag, xmlChar *plainsep);
static xmlChar *pgxml_texttoxmlchar(text *textstring);
static xmlXPathObjectPtr pgxml_xpath(text *document, xmlChar *xpath,
- xpath_workspace *workspace);
+ xpath_workspace *workspace);
static void cleanup_workspace(xpath_workspace *workspace);
#define BRIN_ALL_BLOCKRANGES InvalidBlockNumber
static BrinBuildState *initialize_brin_buildstate(Relation idxRel,
- BrinRevmap *revmap, BlockNumber pagesPerRange);
+ BrinRevmap *revmap, BlockNumber pagesPerRange);
static void terminate_brin_buildstate(BrinBuildState *state);
static void brinsummarize(Relation index, Relation heapRel, BlockNumber pageRange,
- bool include_partial, double *numSummarized, double *numExisting);
+ bool include_partial, double *numSummarized, double *numExisting);
static void form_and_insert_tuple(BrinBuildState *state);
static void union_tuples(BrinDesc *bdesc, BrinMemTuple *a,
- BrinTuple *b);
+ BrinTuple *b);
static void brin_vacuum_scan(Relation idxrel, BufferAccessStrategy strategy);
} InclusionOpaque;
static FmgrInfo *inclusion_get_procinfo(BrinDesc *bdesc, uint16 attno,
- uint16 procnum);
+ uint16 procnum);
static FmgrInfo *inclusion_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno,
- Oid subtype, uint16 strategynum);
+ Oid subtype, uint16 strategynum);
/*
} MinmaxOpaque;
static FmgrInfo *minmax_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno,
- Oid subtype, uint16 strategynum);
+ Oid subtype, uint16 strategynum);
Datum
MAXALIGN(sizeof(BrinSpecialSpace))))
static Buffer brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz,
- bool *extended);
+ bool *extended);
static Size br_page_get_freespace(Page page);
static void brin_initialize_empty_new_buffer(Relation idxrel, Buffer buffer);
static BlockNumber revmap_get_blkno(BrinRevmap *revmap,
- BlockNumber heapBlk);
+ BlockNumber heapBlk);
static Buffer revmap_get_buffer(BrinRevmap *revmap, BlockNumber heapBlk);
static BlockNumber revmap_extend_and_get_blkno(BrinRevmap *revmap,
- BlockNumber heapBlk);
+ BlockNumber heapBlk);
static void revmap_physical_extend(BrinRevmap *revmap);
/*
static inline void brin_deconstruct_tuple(BrinDesc *brdesc,
- char *tp, bits8 *nullbits, bool nulls,
- Datum *values, bool *allnulls, bool *hasnulls);
+ char *tp, bits8 *nullbits, bool nulls,
+ Datum *values, bool *allnulls, bool *hasnulls);
/*
static void printtup_startup(DestReceiver *self, int operation,
- TupleDesc typeinfo);
+ TupleDesc typeinfo);
static bool printtup(TupleTableSlot *slot, DestReceiver *self);
static bool printtup_20(TupleTableSlot *slot, DestReceiver *self);
static bool printtup_internal_20(TupleTableSlot *slot, DestReceiver *self);
static void printtup_destroy(DestReceiver *self);
static void SendRowDescriptionCols_2(StringInfo buf, TupleDesc typeinfo,
- List *targetlist, int16 *formats);
+ List *targetlist, int16 *formats);
static void SendRowDescriptionCols_3(StringInfo buf, TupleDesc typeinfo,
- List *targetlist, int16 *formats);
+ List *targetlist, int16 *formats);
/* ----------------------------------------------------------------
* printtup / debugtup support
static void initialize_reloptions(void);
static void parse_one_reloption(relopt_value *option, char *text_str,
- int text_len, bool validate);
+ int text_len, bool validate);
/*
* initialize_reloptions
static void ginFindParents(GinBtree btree, GinBtreeStack *stack);
static bool ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
- void *insertdata, BlockNumber updateblkno,
- Buffer childbuf, GinStatsData *buildStats);
+ void *insertdata, BlockNumber updateblkno,
+ Buffer childbuf, GinStatsData *buildStats);
static void ginFinishSplit(GinBtree btree, GinBtreeStack *stack,
- bool freestack, GinStatsData *buildStats);
+ bool freestack, GinStatsData *buildStats);
/*
* Lock buffer by needed method for search.
static ItemPointer dataLeafPageGetUncompressed(Page page, int *nitems);
static void dataSplitPageInternal(GinBtree btree, Buffer origbuf,
- GinBtreeStack *stack,
- void *insertdata, BlockNumber updateblkno,
- Page *newlpage, Page *newrpage);
+ GinBtreeStack *stack,
+ void *insertdata, BlockNumber updateblkno,
+ Page *newlpage, Page *newrpage);
static disassembledLeaf *disassembleLeaf(Page page);
static bool leafRepackItems(disassembledLeaf *leaf, ItemPointer remaining);
static bool addItemsToLeaf(disassembledLeaf *leaf, ItemPointer newItems,
- int nNewItems);
+ int nNewItems);
static void computeLeafRecompressWALData(disassembledLeaf *leaf);
static void dataPlaceToPageLeafRecompress(Buffer buf, disassembledLeaf *leaf);
static void dataPlaceToPageLeafSplit(disassembledLeaf *leaf,
- ItemPointerData lbound, ItemPointerData rbound,
- Page lpage, Page rpage);
+ ItemPointerData lbound, ItemPointerData rbound,
+ Page lpage, Page rpage);
/*
* Read TIDs from leaf data page to single uncompressed array. The TIDs are
#include "utils/rel.h"
static void entrySplitPage(GinBtree btree, Buffer origbuf,
- GinBtreeStack *stack,
- GinBtreeEntryInsertData *insertData,
- BlockNumber updateblkno,
- Page *newlpage, Page *newrpage);
+ GinBtreeStack *stack,
+ GinBtreeEntryInsertData *insertData,
+ BlockNumber updateblkno,
+ Page *newlpage, Page *newrpage);
/*
* Form a tuple for entry tree.
/* non-export function prototypes */
static void gistfixsplit(GISTInsertState *state, GISTSTATE *giststate);
static bool gistinserttuple(GISTInsertState *state, GISTInsertStack *stack,
- GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum);
+ GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum);
static bool gistinserttuples(GISTInsertState *state, GISTInsertStack *stack,
- GISTSTATE *giststate,
- IndexTuple *tuples, int ntup, OffsetNumber oldoffnum,
- Buffer leftchild, Buffer rightchild,
- bool unlockbuf, bool unlockleftchild);
+ GISTSTATE *giststate,
+ IndexTuple *tuples, int ntup, OffsetNumber oldoffnum,
+ Buffer leftchild, Buffer rightchild,
+ bool unlockbuf, bool unlockleftchild);
static void gistfinishsplit(GISTInsertState *state, GISTInsertStack *stack,
- GISTSTATE *giststate, List *splitinfo, bool releasebuf);
+ GISTSTATE *giststate, List *splitinfo, bool releasebuf);
static void gistprunepage(Relation rel, Page page, Buffer buffer,
- Relation heapRel);
+ Relation heapRel);
#define ROTATEDIST(d) do { \
static void gistInitBuffering(GISTBuildState *buildstate);
static int calculatePagesPerBuffer(GISTBuildState *buildstate, int levelStep);
static void gistBuildCallback(Relation index,
- HeapTuple htup,
- Datum *values,
- bool *isnull,
- bool tupleIsAlive,
- void *state);
+ HeapTuple htup,
+ Datum *values,
+ bool *isnull,
+ bool tupleIsAlive,
+ void *state);
static void gistBufferingBuildInsert(GISTBuildState *buildstate,
- IndexTuple itup);
+ IndexTuple itup);
static bool gistProcessItup(GISTBuildState *buildstate, IndexTuple itup,
- BlockNumber startblkno, int startlevel);
+ BlockNumber startblkno, int startlevel);
static BlockNumber gistbufferinginserttuples(GISTBuildState *buildstate,
- Buffer buffer, int level,
- IndexTuple *itup, int ntup, OffsetNumber oldoffnum,
- BlockNumber parentblk, OffsetNumber downlinkoffnum);
+ Buffer buffer, int level,
+ IndexTuple *itup, int ntup, OffsetNumber oldoffnum,
+ BlockNumber parentblk, OffsetNumber downlinkoffnum);
static Buffer gistBufferingFindCorrectParent(GISTBuildState *buildstate,
- BlockNumber childblkno, int level,
- BlockNumber *parentblk,
- OffsetNumber *downlinkoffnum);
+ BlockNumber childblkno, int level,
+ BlockNumber *parentblk,
+ OffsetNumber *downlinkoffnum);
static void gistProcessEmptyingQueue(GISTBuildState *buildstate);
static void gistEmptyAllBuffers(GISTBuildState *buildstate);
static int gistGetMaxLevel(Relation index);
static void gistInitParentMap(GISTBuildState *buildstate);
static void gistMemorizeParent(GISTBuildState *buildstate, BlockNumber child,
- BlockNumber parent);
+ BlockNumber parent);
static void gistMemorizeAllDownlinks(GISTBuildState *buildstate, Buffer parent);
static BlockNumber gistGetParent(GISTBuildState *buildstate, BlockNumber child);
static GISTNodeBufferPage *gistAllocateNewPageBuffer(GISTBuildBuffers *gfbb);
static void gistAddLoadedBuffer(GISTBuildBuffers *gfbb,
- GISTNodeBuffer *nodeBuffer);
+ GISTNodeBuffer *nodeBuffer);
static void gistLoadNodeBuffer(GISTBuildBuffers *gfbb,
- GISTNodeBuffer *nodeBuffer);
+ GISTNodeBuffer *nodeBuffer);
static void gistUnloadNodeBuffer(GISTBuildBuffers *gfbb,
- GISTNodeBuffer *nodeBuffer);
+ GISTNodeBuffer *nodeBuffer);
static void gistPlaceItupToPage(GISTNodeBufferPage *pageBuffer,
- IndexTuple item);
+ IndexTuple item);
static void gistGetItupFromPage(GISTNodeBufferPage *pageBuffer,
- IndexTuple *item);
+ IndexTuple *item);
static long gistBuffersGetFreeBlock(GISTBuildBuffers *gfbb);
static void gistBuffersReleaseBlock(GISTBuildBuffers *gfbb, long blocknum);
static bool gist_box_leaf_consistent(BOX *key, BOX *query,
- StrategyNumber strategy);
+ StrategyNumber strategy);
static bool rtree_internal_consistent(BOX *key, BOX *query,
- StrategyNumber strategy);
+ StrategyNumber strategy);
/* Minimum accepted ratio of split */
#define LIMIT_RATIO 0.3
} GistVacState;
static void gistvacuumscan(IndexVacuumInfo *info, GistBulkDeleteResult *stats,
- IndexBulkDeleteCallback callback, void *callback_state);
+ IndexBulkDeleteCallback callback, void *callback_state);
static void gistvacuumpage(GistVacState *vstate, BlockNumber blkno,
- BlockNumber orig_blkno);
+ BlockNumber orig_blkno);
static void gistvacuum_delete_empty_pages(IndexVacuumInfo *info,
- GistBulkDeleteResult *stats);
+ GistBulkDeleteResult *stats);
static bool gistdeletepage(IndexVacuumInfo *info, GistBulkDeleteResult *stats,
- Buffer buffer, OffsetNumber downlink,
- Buffer leafBuffer);
+ Buffer buffer, OffsetNumber downlink,
+ Buffer leafBuffer);
/* allocate the 'stats' struct that's kept over vacuum stages */
static GistBulkDeleteResult *
} HashBuildState;
static void hashbuildCallback(Relation index,
- HeapTuple htup,
- Datum *values,
- bool *isnull,
- bool tupleIsAlive,
- void *state);
+ HeapTuple htup,
+ Datum *values,
+ bool *isnull,
+ bool tupleIsAlive,
+ void *state);
/*
#include "storage/predicate.h"
static void _hash_vacuum_one_page(Relation rel, Relation hrel,
- Buffer metabuf, Buffer buf);
+ Buffer metabuf, Buffer buf);
/*
* _hash_doinsert() -- Handle insertion of a single index tuple.
static bool _hash_alloc_buckets(Relation rel, BlockNumber firstblock,
- uint32 nblocks);
+ uint32 nblocks);
static void _hash_splitbucket(Relation rel, Buffer metabuf,
- Bucket obucket, Bucket nbucket,
- Buffer obuf,
- Buffer nbuf,
- HTAB *htab,
- uint32 maxbucket,
- uint32 highmask, uint32 lowmask);
+ Bucket obucket, Bucket nbucket,
+ Buffer obuf,
+ Buffer nbuf,
+ HTAB *htab,
+ uint32 maxbucket,
+ uint32 highmask, uint32 lowmask);
static void log_split_page(Relation rel, Buffer buf);
#include "storage/predicate.h"
static bool _hash_readpage(IndexScanDesc scan, Buffer *bufP,
- ScanDirection dir);
-static int _hash_load_qualified_items(IndexScanDesc scan, Page page,
- OffsetNumber offnum, ScanDirection dir);
+ ScanDirection dir);
+static int _hash_load_qualified_items(IndexScanDesc scan, Page page,
+ OffsetNumber offnum, ScanDirection dir);
static inline void _hash_saveitem(HashScanOpaque so, int itemIndex,
- OffsetNumber offnum, IndexTuple itup);
+ OffsetNumber offnum, IndexTuple itup);
static void _hash_readnext(IndexScanDesc scan, Buffer *bufp,
- Page *pagep, HashPageOpaque *opaquep);
+ Page *pagep, HashPageOpaque *opaquep);
/*
* _hash_next() -- Get the next item in a scan.
static HeapTuple heap_prepare_insert(Relation relation, HeapTuple tup,
- TransactionId xid, CommandId cid, int options);
+ TransactionId xid, CommandId cid, int options);
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
- Buffer newbuf, HeapTuple oldtup,
- HeapTuple newtup, HeapTuple old_key_tup,
- bool all_visible_cleared, bool new_all_visible_cleared);
+ Buffer newbuf, HeapTuple oldtup,
+ HeapTuple newtup, HeapTuple old_key_tup,
+ bool all_visible_cleared, bool new_all_visible_cleared);
static Bitmapset *HeapDetermineModifiedColumns(Relation relation,
- Bitmapset *interesting_cols,
- HeapTuple oldtup, HeapTuple newtup);
+ Bitmapset *interesting_cols,
+ HeapTuple oldtup, HeapTuple newtup);
static bool heap_acquire_tuplock(Relation relation, ItemPointer tid,
- LockTupleMode mode, LockWaitPolicy wait_policy,
- bool *have_tuple_lock);
+ LockTupleMode mode, LockWaitPolicy wait_policy,
+ bool *have_tuple_lock);
static void compute_new_xmax_infomask(TransactionId xmax, uint16 old_infomask,
- uint16 old_infomask2, TransactionId add_to_xmax,
- LockTupleMode mode, bool is_update,
- TransactionId *result_xmax, uint16 *result_infomask,
- uint16 *result_infomask2);
+ uint16 old_infomask2, TransactionId add_to_xmax,
+ LockTupleMode mode, bool is_update,
+ TransactionId *result_xmax, uint16 *result_infomask,
+ uint16 *result_infomask2);
static TM_Result heap_lock_updated_tuple(Relation rel, HeapTuple tuple,
- ItemPointer ctid, TransactionId xid,
- LockTupleMode mode);
+ ItemPointer ctid, TransactionId xid,
+ LockTupleMode mode);
static void GetMultiXactIdHintBits(MultiXactId multi, uint16 *new_infomask,
- uint16 *new_infomask2);
+ uint16 *new_infomask2);
static TransactionId MultiXactIdGetUpdateXid(TransactionId xmax,
- uint16 t_infomask);
+ uint16 t_infomask);
static bool DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask,
- LockTupleMode lockmode);
+ LockTupleMode lockmode);
static void MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask,
- Relation rel, ItemPointer ctid, XLTW_Oper oper,
- int *remaining);
+ Relation rel, ItemPointer ctid, XLTW_Oper oper,
+ int *remaining);
static bool ConditionalMultiXactIdWait(MultiXactId multi, MultiXactStatus status,
- uint16 infomask, Relation rel, int *remaining);
+ uint16 infomask, Relation rel, int *remaining);
static XLogRecPtr log_heap_new_cid(Relation relation, HeapTuple tup);
static HeapTuple ExtractReplicaIdentity(Relation rel, HeapTuple tup, bool key_modified,
- bool *copy);
+ bool *copy);
/*
static void reform_and_rewrite_tuple(HeapTuple tuple,
- Relation OldHeap, Relation NewHeap,
- Datum *values, bool *isnull, RewriteState rwstate);
+ Relation OldHeap, Relation NewHeap,
+ Datum *values, bool *isnull, RewriteState rwstate);
static bool SampleHeapTupleVisible(TableScanDesc scan, Buffer buffer,
- HeapTuple tuple,
- OffsetNumber tupoffset);
+ HeapTuple tuple,
+ OffsetNumber tupoffset);
static BlockNumber heapam_scan_get_blocks_done(HeapScanDesc hscan);
} PruneState;
/* Local functions */
-static int heap_prune_chain(Relation relation, Buffer buffer,
- OffsetNumber rootoffnum,
- TransactionId OldestXmin,
- PruneState *prstate);
+static int heap_prune_chain(Relation relation, Buffer buffer,
+ OffsetNumber rootoffnum,
+ TransactionId OldestXmin,
+ PruneState *prstate);
static void heap_prune_record_prunable(PruneState *prstate, TransactionId xid);
static void heap_prune_record_redirect(PruneState *prstate,
- OffsetNumber offnum, OffsetNumber rdoffnum);
+ OffsetNumber offnum, OffsetNumber rdoffnum);
static void heap_prune_record_dead(PruneState *prstate, OffsetNumber offnum);
static void heap_prune_record_unused(PruneState *prstate, OffsetNumber offnum);
/* prototypes for internal functions */
static BlockNumber ss_search(RelFileNode relfilenode,
- BlockNumber location, bool set);
+ BlockNumber location, bool set);
/*
static void toast_delete_datum(Relation rel, Datum value, bool is_speculative);
static Datum toast_save_datum(Relation rel, Datum value,
- struct varlena *oldexternal, int options);
+ struct varlena *oldexternal, int options);
static bool toastrel_valueid_exists(Relation toastrel, Oid valueid);
static bool toastid_valueid_exists(Oid toastrelid, Oid valueid);
static struct varlena *toast_fetch_datum(struct varlena *attr);
static struct varlena *toast_fetch_datum_slice(struct varlena *attr,
- int32 sliceoffset, int32 length);
+ int32 sliceoffset, int32 length);
static struct varlena *toast_decompress_datum(struct varlena *attr);
static struct varlena *toast_decompress_datum_slice(struct varlena *attr, int32 slicelength);
-static int toast_open_indexes(Relation toastrel,
- LOCKMODE lock,
- Relation **toastidxs,
- int *num_indexes);
+static int toast_open_indexes(Relation toastrel,
+ LOCKMODE lock,
+ Relation **toastidxs,
+ int *num_indexes);
static void toast_close_indexes(Relation *toastidxs, int num_indexes,
- LOCKMODE lock);
+ LOCKMODE lock);
static void init_toast_snapshot(Snapshot toast_snapshot);
/* non-export function prototypes */
static void lazy_scan_heap(Relation onerel, VacuumParams *params,
- LVRelStats *vacrelstats, Relation *Irel, int nindexes,
- bool aggressive);
+ LVRelStats *vacrelstats, Relation *Irel, int nindexes,
+ bool aggressive);
static void lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats);
static bool lazy_check_needs_freeze(Buffer buf, bool *hastup);
static void lazy_vacuum_index(Relation indrel,
- IndexBulkDeleteResult **stats,
- LVRelStats *vacrelstats);
+ IndexBulkDeleteResult **stats,
+ LVRelStats *vacrelstats);
static void lazy_cleanup_index(Relation indrel,
- IndexBulkDeleteResult *stats,
- LVRelStats *vacrelstats);
-static int lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
- int tupindex, LVRelStats *vacrelstats, Buffer *vmbuffer);
+ IndexBulkDeleteResult *stats,
+ LVRelStats *vacrelstats);
+static int lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
+ int tupindex, LVRelStats *vacrelstats, Buffer *vmbuffer);
static bool should_attempt_truncation(VacuumParams *params,
- LVRelStats *vacrelstats);
+ LVRelStats *vacrelstats);
static void lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats);
static BlockNumber count_nondeletable_pages(Relation onerel,
- LVRelStats *vacrelstats);
+ LVRelStats *vacrelstats);
static void lazy_space_alloc(LVRelStats *vacrelstats, BlockNumber relblocks);
static void lazy_record_dead_tuple(LVRelStats *vacrelstats,
- ItemPointer itemptr);
+ ItemPointer itemptr);
static bool lazy_tid_reaped(ItemPointer itemptr, void *state);
static int vac_cmp_itemptr(const void *left, const void *right);
static bool heap_page_is_all_visible(Relation rel, Buffer buf,
- TransactionId *visibility_cutoff_xid, bool *all_frozen);
+ TransactionId *visibility_cutoff_xid, bool *all_frozen);
/*
} while(0)
static IndexScanDesc index_beginscan_internal(Relation indexRelation,
- int nkeys, int norderbys, Snapshot snapshot,
- ParallelIndexScanDesc pscan, bool temp_snap);
+ int nkeys, int norderbys, Snapshot snapshot,
+ ParallelIndexScanDesc pscan, bool temp_snap);
/* ----------------------------------------------------------------
static Buffer _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
static TransactionId _bt_check_unique(Relation rel, BTInsertState insertstate,
- Relation heapRel,
- IndexUniqueCheck checkUnique, bool *is_unique,
- uint32 *speculativeToken);
+ Relation heapRel,
+ IndexUniqueCheck checkUnique, bool *is_unique,
+ uint32 *speculativeToken);
static OffsetNumber _bt_findinsertloc(Relation rel,
- BTInsertState insertstate,
- bool checkingunique,
- BTStack stack,
- Relation heapRel);
+ BTInsertState insertstate,
+ bool checkingunique,
+ BTStack stack,
+ Relation heapRel);
static void _bt_stepright(Relation rel, BTInsertState insertstate, BTStack stack);
static void _bt_insertonpg(Relation rel, BTScanInsert itup_key,
- Buffer buf,
- Buffer cbuf,
- BTStack stack,
- IndexTuple itup,
- OffsetNumber newitemoff,
- bool split_only_page);
+ Buffer buf,
+ Buffer cbuf,
+ BTStack stack,
+ IndexTuple itup,
+ OffsetNumber newitemoff,
+ bool split_only_page);
static Buffer _bt_split(Relation rel, BTScanInsert itup_key, Buffer buf,
- Buffer cbuf, OffsetNumber newitemoff, Size newitemsz,
- IndexTuple newitem);
+ Buffer cbuf, OffsetNumber newitemoff, Size newitemsz,
+ IndexTuple newitem);
static void _bt_insert_parent(Relation rel, Buffer buf, Buffer rbuf,
- BTStack stack, bool is_root, bool is_only);
+ BTStack stack, bool is_root, bool is_only);
static bool _bt_pgaddtup(Page page, Size itemsize, IndexTuple itup,
- OffsetNumber itup_off);
+ OffsetNumber itup_off);
static void _bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel);
/*
static BTMetaPageData *_bt_getmeta(Relation rel, Buffer metabuf);
static bool _bt_mark_page_halfdead(Relation rel, Buffer buf, BTStack stack);
static bool _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf,
- bool *rightsib_empty);
+ bool *rightsib_empty);
static bool _bt_lock_branch_parent(Relation rel, BlockNumber child,
- BTStack stack, Buffer *topparent, OffsetNumber *topoff,
- BlockNumber *target, BlockNumber *rightsib);
+ BTStack stack, Buffer *topparent, OffsetNumber *topoff,
+ BlockNumber *target, BlockNumber *rightsib);
static void _bt_log_reuse_page(Relation rel, BlockNumber blkno,
- TransactionId latestRemovedXid);
+ TransactionId latestRemovedXid);
/*
* _bt_initmetapage() -- Fill a page buffer with a correct metapage image
static void btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
- IndexBulkDeleteCallback callback, void *callback_state,
- BTCycleId cycleid, TransactionId *oldestBtpoXact);
+ IndexBulkDeleteCallback callback, void *callback_state,
+ BTCycleId cycleid, TransactionId *oldestBtpoXact);
static void btvacuumpage(BTVacState *vstate, BlockNumber blkno,
- BlockNumber orig_blkno);
+ BlockNumber orig_blkno);
/*
static void _bt_drop_lock_and_maybe_pin(IndexScanDesc scan, BTScanPos sp);
static OffsetNumber _bt_binsrch(Relation rel, BTScanInsert key, Buffer buf);
static bool _bt_readpage(IndexScanDesc scan, ScanDirection dir,
- OffsetNumber offnum);
+ OffsetNumber offnum);
static void _bt_saveitem(BTScanOpaque so, int itemIndex,
- OffsetNumber offnum, IndexTuple itup);
+ OffsetNumber offnum, IndexTuple itup);
static bool _bt_steppage(IndexScanDesc scan, ScanDirection dir);
static bool _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir);
static bool _bt_parallel_readpage(IndexScanDesc scan, BlockNumber blkno,
- ScanDirection dir);
+ ScanDirection dir);
static Buffer _bt_walk_left(Relation rel, Buffer buf, Snapshot snapshot);
static bool _bt_endpoint(IndexScanDesc scan, ScanDirection dir);
static inline void _bt_initialize_more_data(BTScanOpaque so, ScanDirection dir);
static double _bt_spools_heapscan(Relation heap, Relation index,
- BTBuildState *buildstate, IndexInfo *indexInfo);
+ BTBuildState *buildstate, IndexInfo *indexInfo);
static void _bt_spooldestroy(BTSpool *btspool);
static void _bt_spool(BTSpool *btspool, ItemPointer self,
- Datum *values, bool *isnull);
+ Datum *values, bool *isnull);
static void _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2);
static void _bt_build_callback(Relation index, HeapTuple htup, Datum *values,
- bool *isnull, bool tupleIsAlive, void *state);
+ bool *isnull, bool tupleIsAlive, void *state);
static Page _bt_blnewpage(uint32 level);
static BTPageState *_bt_pagestate(BTWriteState *wstate, uint32 level);
static void _bt_slideleft(Page page);
static void _bt_sortaddtup(Page page, Size itemsize,
- IndexTuple itup, OffsetNumber itup_off);
+ IndexTuple itup, OffsetNumber itup_off);
static void _bt_buildadd(BTWriteState *wstate, BTPageState *state,
- IndexTuple itup);
+ IndexTuple itup);
static void _bt_uppershutdown(BTWriteState *wstate, BTPageState *state);
static void _bt_load(BTWriteState *wstate,
- BTSpool *btspool, BTSpool *btspool2);
+ BTSpool *btspool, BTSpool *btspool2);
static void _bt_begin_parallel(BTBuildState *buildstate, bool isconcurrent,
- int request);
+ int request);
static void _bt_end_parallel(BTLeader *btleader);
static Size _bt_parallel_estimate_shared(Relation heap, Snapshot snapshot);
static double _bt_parallel_heapscan(BTBuildState *buildstate,
- bool *brokenhotchain);
+ bool *brokenhotchain);
static void _bt_leader_participate_as_worker(BTBuildState *buildstate);
static void _bt_parallel_scan_and_sort(BTSpool *btspool, BTSpool *btspool2,
- BTShared *btshared, Sharedsort *sharedsort,
- Sharedsort *sharedsort2, int sortmem,
- bool progress);
+ BTShared *btshared, Sharedsort *sharedsort,
+ Sharedsort *sharedsort2, int sortmem,
+ bool progress);
/*
} FindSplitData;
static void _bt_recsplitloc(FindSplitData *state,
- OffsetNumber firstoldonright, bool newitemonleft,
- int olddataitemstoleft, Size firstoldonrightsz);
+ OffsetNumber firstoldonright, bool newitemonleft,
+ int olddataitemstoleft, Size firstoldonrightsz);
static void _bt_deltasortsplits(FindSplitData *state, double fillfactormult,
- bool usemult);
+ bool usemult);
static int _bt_splitcmp(const void *arg1, const void *arg2);
static bool _bt_afternewitemoff(FindSplitData *state, OffsetNumber maxoff,
- int leaffillfactor, bool *usemult);
+ int leaffillfactor, bool *usemult);
static bool _bt_adjacenthtid(ItemPointer lowhtid, ItemPointer highhtid);
static OffsetNumber _bt_bestsplitloc(FindSplitData *state, int perfectpenalty,
- bool *newitemonleft);
-static int _bt_strategy(FindSplitData *state, SplitPoint *leftpage,
- SplitPoint *rightpage, FindSplitStrat *strategy);
+ bool *newitemonleft);
+static int _bt_strategy(FindSplitData *state, SplitPoint *leftpage,
+ SplitPoint *rightpage, FindSplitStrat *strategy);
static void _bt_interval_edges(FindSplitData *state,
- SplitPoint **leftinterval, SplitPoint **rightinterval);
+ SplitPoint **leftinterval, SplitPoint **rightinterval);
static inline int _bt_split_penalty(FindSplitData *state, SplitPoint *split);
static inline IndexTuple _bt_split_lastleft(FindSplitData *state,
- SplitPoint *split);
+ SplitPoint *split);
static inline IndexTuple _bt_split_firstright(FindSplitData *state,
- SplitPoint *split);
+ SplitPoint *split);
/*
} BTSortArrayContext;
static Datum _bt_find_extreme_element(IndexScanDesc scan, ScanKey skey,
- StrategyNumber strat,
- Datum *elems, int nelems);
-static int _bt_sort_array_elements(IndexScanDesc scan, ScanKey skey,
- bool reverse,
- Datum *elems, int nelems);
+ StrategyNumber strat,
+ Datum *elems, int nelems);
+static int _bt_sort_array_elements(IndexScanDesc scan, ScanKey skey,
+ bool reverse,
+ Datum *elems, int nelems);
static int _bt_compare_array_elements(const void *a, const void *b, void *arg);
static bool _bt_compare_scankey_args(IndexScanDesc scan, ScanKey op,
- ScanKey leftarg, ScanKey rightarg,
- bool *result);
+ ScanKey leftarg, ScanKey rightarg,
+ bool *result);
static bool _bt_fix_scankey_strategy(ScanKey skey, int16 *indoption);
static void _bt_mark_scankey_required(ScanKey skey);
static bool _bt_check_rowcompare(ScanKey skey,
- IndexTuple tuple, int tupnatts, TupleDesc tupdesc,
- ScanDirection dir, bool *continuescan);
-static int _bt_keep_natts(Relation rel, IndexTuple lastleft,
- IndexTuple firstright, BTScanInsert itup_key);
+ IndexTuple tuple, int tupnatts, TupleDesc tupdesc,
+ ScanDirection dir, bool *continuescan);
+static int _bt_keep_natts(Relation rel, IndexTuple lastleft,
+ IndexTuple firstright, BTScanInsert itup_key);
/*
static void bernoulli_samplescangetsamplesize(PlannerInfo *root,
- RelOptInfo *baserel,
- List *paramexprs,
- BlockNumber *pages,
- double *tuples);
+ RelOptInfo *baserel,
+ List *paramexprs,
+ BlockNumber *pages,
+ double *tuples);
static void bernoulli_initsamplescan(SampleScanState *node,
- int eflags);
+ int eflags);
static void bernoulli_beginsamplescan(SampleScanState *node,
- Datum *params,
- int nparams,
- uint32 seed);
+ Datum *params,
+ int nparams,
+ uint32 seed);
static OffsetNumber bernoulli_nextsampletuple(SampleScanState *node,
- BlockNumber blockno,
- OffsetNumber maxoffset);
+ BlockNumber blockno,
+ OffsetNumber maxoffset);
/*
static void system_samplescangetsamplesize(PlannerInfo *root,
- RelOptInfo *baserel,
- List *paramexprs,
- BlockNumber *pages,
- double *tuples);
+ RelOptInfo *baserel,
+ List *paramexprs,
+ BlockNumber *pages,
+ double *tuples);
static void system_initsamplescan(SampleScanState *node,
- int eflags);
+ int eflags);
static void system_beginsamplescan(SampleScanState *node,
- Datum *params,
- int nparams,
- uint32 seed);
+ Datum *params,
+ int nparams,
+ uint32 seed);
static BlockNumber system_nextsampleblock(SampleScanState *node, BlockNumber nblocks);
static OffsetNumber system_nextsampletuple(SampleScanState *node,
- BlockNumber blockno,
- OffsetNumber maxoffset);
+ BlockNumber blockno,
+ OffsetNumber maxoffset);
/*
static bool CLOGPagePrecedes(int page1, int page2);
static void WriteZeroPageXlogRec(int pageno);
static void WriteTruncateXlogRec(int pageno, TransactionId oldestXact,
- Oid oldestXidDb);
+ Oid oldestXidDb);
static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
- TransactionId *subxids, XidStatus status,
- XLogRecPtr lsn, int pageno,
- bool all_xact_same_page);
+ TransactionId *subxids, XidStatus status,
+ XLogRecPtr lsn, int pageno,
+ bool all_xact_same_page);
static void TransactionIdSetStatusBit(TransactionId xid, XidStatus status,
- XLogRecPtr lsn, int slotno);
+ XLogRecPtr lsn, int slotno);
static void set_status_by_pages(int nsubxids, TransactionId *subxids,
- XidStatus status, XLogRecPtr lsn);
+ XidStatus status, XLogRecPtr lsn);
static bool TransactionGroupUpdateXidStatus(TransactionId xid,
- XidStatus status, XLogRecPtr lsn, int pageno);
+ XidStatus status, XLogRecPtr lsn, int pageno);
static void TransactionIdSetPageStatusInternal(TransactionId xid, int nsubxids,
- TransactionId *subxids, XidStatus status,
- XLogRecPtr lsn, int pageno);
+ TransactionId *subxids, XidStatus status,
+ XLogRecPtr lsn, int pageno);
/*
bool track_commit_timestamp;
static void SetXidCommitTsInPage(TransactionId xid, int nsubxids,
- TransactionId *subxids, TimestampTz ts,
- RepOriginId nodeid, int pageno);
+ TransactionId *subxids, TimestampTz ts,
+ RepOriginId nodeid, int pageno);
static void TransactionIdSetCommitTs(TransactionId xid, TimestampTz ts,
- RepOriginId nodeid, int slotno);
+ RepOriginId nodeid, int slotno);
static void error_commit_ts_disabled(void);
static int ZeroCommitTsPage(int pageno, bool writeXlog);
static bool CommitTsPagePrecedes(int page1, int page2);
static void WriteZeroPageXlogRec(int pageno);
static void WriteTruncateXlogRec(int pageno, TransactionId oldestXid);
static void WriteSetTimestampXlogRec(TransactionId mainxid, int nsubxids,
- TransactionId *subxids, TimestampTz timestamp,
- RepOriginId nodeid);
+ TransactionId *subxids, TimestampTz timestamp,
+ RepOriginId nodeid);
/*
* TransactionTreeSetCommitTsData
};
static void writeFragment(PageData *pageData, OffsetNumber offset,
- OffsetNumber len, const char *data);
+ OffsetNumber len, const char *data);
static void computeRegionDelta(PageData *pageData,
- const char *curpage, const char *targetpage,
- int targetStart, int targetEnd,
- int validStart, int validEnd);
+ const char *curpage, const char *targetpage,
+ int targetStart, int targetEnd,
+ int validStart, int validEnd);
static void computeDelta(PageData *pageData, Page curpage, Page targetpage);
static void applyPageRedo(Page page, const char *delta, Size deltaSize);
/* internal MultiXactId management */
static void MultiXactIdSetOldestVisible(void);
static void RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
- int nmembers, MultiXactMember *members);
+ int nmembers, MultiXactMember *members);
static MultiXactId GetNewMultiXactId(int nmembers, MultiXactOffset *offset);
/* MultiXact cache management */
static MultiXactId mXactCacheGetBySet(int nmembers, MultiXactMember *members);
static int mXactCacheGetById(MultiXactId multi, MultiXactMember **members);
static void mXactCachePut(MultiXactId multi, int nmembers,
- MultiXactMember *members);
+ MultiXactMember *members);
static char *mxstatus_to_string(MultiXactStatus status);
static bool MultiXactOffsetPagePrecedes(int page1, int page2);
static bool MultiXactMemberPagePrecedes(int page1, int page2);
static bool MultiXactOffsetPrecedes(MultiXactOffset offset1,
- MultiXactOffset offset2);
+ MultiXactOffset offset2);
static void ExtendMultiXactOffset(MultiXactId multi);
static void ExtendMultiXactMember(MultiXactOffset offset, int nmembers);
static bool MultiXactOffsetWouldWrap(MultiXactOffset boundary,
- MultiXactOffset start, uint32 distance);
+ MultiXactOffset start, uint32 distance);
static bool SetOffsetVacuumLimit(bool is_startup);
static bool find_multixact_start(MultiXactId multi, MultiXactOffset *result);
static void WriteMZeroPageXlogRec(int pageno, uint8 info);
static void WriteMTruncateXlogRec(Oid oldestMultiDB,
- MultiXactId startOff, MultiXactId endOff,
- MultiXactOffset startMemb, MultiXactOffset endMemb);
+ MultiXactId startOff, MultiXactId endOff,
+ MultiXactOffset startMemb, MultiXactOffset endMemb);
/*
static void SlruInternalWritePage(SlruCtl ctl, int slotno, SlruFlush fdata);
static bool SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno);
static bool SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno,
- SlruFlush fdata);
+ SlruFlush fdata);
static void SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid);
static int SlruSelectLRUPage(SlruCtl ctl, int pageno);
static bool SlruScanDirCbDeleteCutoff(SlruCtl ctl, char *filename,
- int segpage, void *data);
+ int segpage, void *data);
static void SlruInternalDeleteSegment(SlruCtl ctl, char *filename);
/*
static bool twophaseExitRegistered = false;
static void RecordTransactionCommitPrepared(TransactionId xid,
- int nchildren,
- TransactionId *children,
- int nrels,
- RelFileNode *rels,
- int ninvalmsgs,
- SharedInvalidationMessage *invalmsgs,
- bool initfileinval,
- const char *gid);
+ int nchildren,
+ TransactionId *children,
+ int nrels,
+ RelFileNode *rels,
+ int ninvalmsgs,
+ SharedInvalidationMessage *invalmsgs,
+ bool initfileinval,
+ const char *gid);
static void RecordTransactionAbortPrepared(TransactionId xid,
- int nchildren,
- TransactionId *children,
- int nrels,
- RelFileNode *rels,
- const char *gid);
+ int nchildren,
+ TransactionId *children,
+ int nrels,
+ RelFileNode *rels,
+ const char *gid);
static void ProcessRecords(char *bufptr, TransactionId xid,
- const TwoPhaseCallback callbacks[]);
+ const TwoPhaseCallback callbacks[]);
static void RemoveGXact(GlobalTransaction gxact);
static void XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len);
static char *ProcessTwoPhaseBuffer(TransactionId xid,
- XLogRecPtr prepare_start_lsn,
- bool fromdisk, bool setParent, bool setNextXid);
+ XLogRecPtr prepare_start_lsn,
+ bool fromdisk, bool setParent, bool setNextXid);
static void MarkAsPreparingGuts(GlobalTransaction gxact, TransactionId xid,
- const char *gid, TimestampTz prepared_at, Oid owner,
- Oid databaseid);
+ const char *gid, TimestampTz prepared_at, Oid owner,
+ Oid databaseid);
static void RemoveTwoPhaseFile(TransactionId xid, bool giveWarning);
static void RecreateTwoPhaseFile(TransactionId xid, void *content, int len);
static void AtStart_ResourceOwner(void);
static void CallXactCallbacks(XactEvent event);
static void CallSubXactCallbacks(SubXactEvent event,
- SubTransactionId mySubid,
- SubTransactionId parentSubid);
+ SubTransactionId mySubid,
+ SubTransactionId parentSubid);
static void CleanupTransaction(void);
static void CheckTransactionBlock(bool isTopLevel, bool throwError,
- const char *stmtType);
+ const char *stmtType);
static void CommitTransaction(void);
static TransactionId RecordTransactionAbort(bool isSubXact);
static void StartTransaction(void);
static void CheckRequiredParameterValues(void);
static void XLogReportParameters(void);
static void checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI,
- TimeLineID prevTLI);
+ TimeLineID prevTLI);
static void LocalSetXLogInsertAllowed(void);
static void CreateEndOfRecoveryRecord(void);
static void CheckPointGuts(XLogRecPtr checkPointRedo, int flags);
static bool XLogCheckpointNeeded(XLogSegNo new_segno);
static void XLogWrite(XLogwrtRqst WriteRqst, bool flexible);
static bool InstallXLogFileSegment(XLogSegNo *segno, char *tmppath,
- bool find_free, XLogSegNo max_segno,
- bool use_lock);
-static int XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
- int source, bool notfoundOk);
+ bool find_free, XLogSegNo max_segno,
+ bool use_lock);
+static int XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
+ int source, bool notfoundOk);
static int XLogFileReadAnyTLI(XLogSegNo segno, int emode, int source);
-static int XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
- int reqLen, XLogRecPtr targetRecPtr, char *readBuf,
- TimeLineID *readTLI);
+static int XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
+ int reqLen, XLogRecPtr targetRecPtr, char *readBuf,
+ TimeLineID *readTLI);
static bool WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
- bool fetching_ckpt, XLogRecPtr tliRecPtr);
+ bool fetching_ckpt, XLogRecPtr tliRecPtr);
static int emode_for_corrupt_record(int emode, XLogRecPtr RecPtr);
static void XLogFileClose(void);
static void PreallocXlogFiles(XLogRecPtr endptr);
static void CleanupBackupHistory(void);
static void UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force);
static XLogRecord *ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr,
- int emode, bool fetching_ckpt);
+ int emode, bool fetching_ckpt);
static void CheckRecoveryConsistency(void);
static XLogRecord *ReadCheckpointRecord(XLogReaderState *xlogreader,
- XLogRecPtr RecPtr, int whichChkpti, bool report);
+ XLogRecPtr RecPtr, int whichChkpti, bool report);
static bool rescanLatestTimeLine(void);
static void WriteControlFile(void);
static void ReadControlFile(void);
static void pg_start_backup_callback(int code, Datum arg);
static void pg_stop_backup_callback(int code, Datum arg);
static bool read_backup_label(XLogRecPtr *checkPointLoc,
- bool *backupEndRequired, bool *backupFromStandby);
+ bool *backupEndRequired, bool *backupFromStandby);
static bool read_tablespace_map(List **tablespaces);
static void rm_redo_error_callback(void *arg);
static int get_sync_bit(int method);
static void CopyXLogRecordToWAL(int write_len, bool isLogSwitch,
- XLogRecData *rdata,
- XLogRecPtr StartPos, XLogRecPtr EndPos);
+ XLogRecData *rdata,
+ XLogRecPtr StartPos, XLogRecPtr EndPos);
static void ReserveXLogInsertLocation(int size, XLogRecPtr *StartPos,
- XLogRecPtr *EndPos, XLogRecPtr *PrevPtr);
+ XLogRecPtr *EndPos, XLogRecPtr *PrevPtr);
static bool ReserveXLogSwitch(XLogRecPtr *StartPos, XLogRecPtr *EndPos,
- XLogRecPtr *PrevPtr);
+ XLogRecPtr *PrevPtr);
static XLogRecPtr WaitXLogInsertionsToFinish(XLogRecPtr upto);
static char *GetXLogBuffer(XLogRecPtr ptr);
static XLogRecPtr XLogBytePosToRecPtr(uint64 bytepos);
static MemoryContext xloginsert_cxt;
static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info,
- XLogRecPtr RedoRecPtr, bool doPageWrites,
- XLogRecPtr *fpw_lsn);
+ XLogRecPtr RedoRecPtr, bool doPageWrites,
+ XLogRecPtr *fpw_lsn);
static bool XLogCompressBackupBlock(char *page, uint16 hole_offset,
- uint16 hole_length, char *dest, uint16 *dlen);
+ uint16 hole_length, char *dest, uint16 *dlen);
/*
* Begin constructing a WAL record. This must be called before the
static bool allocate_recordbuf(XLogReaderState *state, uint32 reclength);
static bool ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
- XLogRecPtr PrevRecPtr, XLogRecord *record, bool randAccess);
+ XLogRecPtr PrevRecPtr, XLogRecord *record, bool randAccess);
static bool ValidXLogRecord(XLogReaderState *state, XLogRecord *record,
- XLogRecPtr recptr);
-static int ReadPageInternal(XLogReaderState *state, XLogRecPtr pageptr,
- int reqLen);
+ XLogRecPtr recptr);
+static int ReadPageInternal(XLogReaderState *state, XLogRecPtr pageptr,
+ int reqLen);
static void report_invalid_record(XLogReaderState *state, const char *fmt,...) pg_attribute_printf(2, 3);
static void ResetDecoder(XLogReaderState *state);
static List *objectsInSchemaToOids(ObjectType objtype, List *nspnames);
static List *getRelationsInNamespace(Oid namespaceId, char relkind);
static void expand_col_privileges(List *colnames, Oid table_oid,
- AclMode this_privileges,
- AclMode *col_privileges,
- int num_col_privileges);
+ AclMode this_privileges,
+ AclMode *col_privileges,
+ int num_col_privileges);
static void expand_all_col_privileges(Oid table_oid, Form_pg_class classForm,
- AclMode this_privileges,
- AclMode *col_privileges,
- int num_col_privileges);
+ AclMode this_privileges,
+ AclMode *col_privileges,
+ int num_col_privileges);
static AclMode string_to_privilege(const char *privname);
static const char *privilege_to_string(AclMode privilege);
static AclMode restrict_and_check_grant(bool is_grant, AclMode avail_goptions,
- bool all_privs, AclMode privileges,
- Oid objectId, Oid grantorId,
- ObjectType objtype, const char *objname,
- AttrNumber att_number, const char *colname);
+ bool all_privs, AclMode privileges,
+ Oid objectId, Oid grantorId,
+ ObjectType objtype, const char *objname,
+ AttrNumber att_number, const char *colname);
static AclMode pg_aclmask(ObjectType objtype, Oid table_oid, AttrNumber attnum,
- Oid roleid, AclMode mask, AclMaskHow how);
+ Oid roleid, AclMode mask, AclMaskHow how);
static void recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid,
- Acl *new_acl);
+ Acl *new_acl);
static void recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid,
- Acl *new_acl);
+ Acl *new_acl);
#ifdef ACLDEBUG
static void findDependentObjects(const ObjectAddress *object,
- int objflags,
- int flags,
- ObjectAddressStack *stack,
- ObjectAddresses *targetObjects,
- const ObjectAddresses *pendingObjects,
- Relation *depRel);
+ int objflags,
+ int flags,
+ ObjectAddressStack *stack,
+ ObjectAddresses *targetObjects,
+ const ObjectAddresses *pendingObjects,
+ Relation *depRel);
static void reportDependentObjects(const ObjectAddresses *targetObjects,
- DropBehavior behavior,
- int flags,
- const ObjectAddress *origObject);
+ DropBehavior behavior,
+ int flags,
+ const ObjectAddress *origObject);
static void deleteOneObject(const ObjectAddress *object,
- Relation *depRel, int32 flags);
+ Relation *depRel, int32 flags);
static void doDeletion(const ObjectAddress *object, int flags);
static void AcquireDeletionLock(const ObjectAddress *object, int flags);
static void ReleaseDeletionLock(const ObjectAddress *object);
static bool find_expr_references_walker(Node *node,
- find_expr_references_context *context);
+ find_expr_references_context *context);
static void eliminate_duplicate_dependencies(ObjectAddresses *addrs);
static int object_address_comparator(const void *a, const void *b);
static void add_object_address(ObjectClass oclass, Oid objectId, int32 subId,
- ObjectAddresses *addrs);
-static void add_exact_object_address_extra(const ObjectAddress *object,
- const ObjectAddressExtra *extra,
ObjectAddresses *addrs);
+static void add_exact_object_address_extra(const ObjectAddress *object,
+ const ObjectAddressExtra *extra,
+ ObjectAddresses *addrs);
static bool object_address_present_add_flags(const ObjectAddress *object,
- int flags,
- ObjectAddresses *addrs);
+ int flags,
+ ObjectAddresses *addrs);
static bool stack_address_present_add_flags(const ObjectAddress *object,
- int flags,
- ObjectAddressStack *stack);
+ int flags,
+ ObjectAddressStack *stack);
static void DeleteInitPrivs(const ObjectAddress *object);
Oid binary_upgrade_next_toast_pg_class_oid = InvalidOid;
static void AddNewRelationTuple(Relation pg_class_desc,
- Relation new_rel_desc,
- Oid new_rel_oid,
- Oid new_type_oid,
- Oid reloftype,
- Oid relowner,
- char relkind,
- TransactionId relfrozenxid,
- TransactionId relminmxid,
- Datum relacl,
- Datum reloptions);
+ Relation new_rel_desc,
+ Oid new_rel_oid,
+ Oid new_type_oid,
+ Oid reloftype,
+ Oid relowner,
+ char relkind,
+ TransactionId relfrozenxid,
+ TransactionId relminmxid,
+ Datum relacl,
+ Datum reloptions);
static ObjectAddress AddNewRelationType(const char *typeName,
- Oid typeNamespace,
- Oid new_rel_oid,
- char new_rel_kind,
- Oid ownerid,
- Oid new_row_type,
- Oid new_array_type);
+ Oid typeNamespace,
+ Oid new_rel_oid,
+ char new_rel_kind,
+ Oid ownerid,
+ Oid new_row_type,
+ Oid new_array_type);
static void RelationRemoveInheritance(Oid relid);
-static Oid StoreRelCheck(Relation rel, const char *ccname, Node *expr,
- bool is_validated, bool is_local, int inhcount,
- bool is_no_inherit, bool is_internal);
+static Oid StoreRelCheck(Relation rel, const char *ccname, Node *expr,
+ bool is_validated, bool is_local, int inhcount,
+ bool is_no_inherit, bool is_internal);
static void StoreConstraints(Relation rel, List *cooked_constraints,
- bool is_internal);
+ bool is_internal);
static bool MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
- bool allow_merge, bool is_local,
- bool is_initially_valid,
- bool is_no_inherit);
+ bool allow_merge, bool is_local,
+ bool is_initially_valid,
+ bool is_no_inherit);
static void SetRelationNumChecks(Relation rel, int numchecks);
static Node *cookConstraint(ParseState *pstate,
- Node *raw_constraint,
- char *relname);
+ Node *raw_constraint,
+ char *relname);
static List *insert_ordered_unique_oid(List *list, Oid datum);
/* non-export function prototypes */
static bool relationHasPrimaryKey(Relation rel);
static TupleDesc ConstructTupleDescriptor(Relation heapRelation,
- IndexInfo *indexInfo,
- List *indexColNames,
- Oid accessMethodObjectId,
- Oid *collationObjectId,
- Oid *classObjectId);
+ IndexInfo *indexInfo,
+ List *indexColNames,
+ Oid accessMethodObjectId,
+ Oid *collationObjectId,
+ Oid *classObjectId);
static void InitializeAttributeOids(Relation indexRelation,
- int numatts, Oid indexoid);
+ int numatts, Oid indexoid);
static void AppendAttributeTuples(Relation indexRelation, int numatts);
static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
- Oid parentIndexId,
- IndexInfo *indexInfo,
- Oid *collationOids,
- Oid *classOids,
- int16 *coloptions,
- bool primary,
- bool isexclusion,
- bool immediate,
- bool isvalid,
- bool isready);
+ Oid parentIndexId,
+ IndexInfo *indexInfo,
+ Oid *collationOids,
+ Oid *classOids,
+ int16 *coloptions,
+ bool primary,
+ bool isexclusion,
+ bool immediate,
+ bool isvalid,
+ bool isready);
static void index_update_stats(Relation rel,
- bool hasindex,
- double reltuples);
+ bool hasindex,
+ double reltuples);
static void IndexCheckExclusion(Relation heapRelation,
- Relation indexRelation,
- IndexInfo *indexInfo);
+ Relation indexRelation,
+ IndexInfo *indexInfo);
static bool validate_index_callback(ItemPointer itemptr, void *opaque);
static bool ReindexIsCurrentlyProcessingIndex(Oid indexOid);
static void SetReindexProcessing(Oid heapOid, Oid indexOid);
static void RemoveTempRelationsCallback(int code, Datum arg);
static void NamespaceCallback(Datum arg, int cacheid, uint32 hashvalue);
static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
- int **argnumbers);
+ int **argnumbers);
/*
};
static ObjectAddress get_object_address_unqualified(ObjectType objtype,
- Value *strval, bool missing_ok);
+ Value *strval, bool missing_ok);
static ObjectAddress get_relation_by_qualified_name(ObjectType objtype,
- List *object, Relation *relp,
- LOCKMODE lockmode, bool missing_ok);
+ List *object, Relation *relp,
+ LOCKMODE lockmode, bool missing_ok);
static ObjectAddress get_object_address_relobject(ObjectType objtype,
- List *object, Relation *relp, bool missing_ok);
+ List *object, Relation *relp, bool missing_ok);
static ObjectAddress get_object_address_attribute(ObjectType objtype,
- List *object, Relation *relp,
- LOCKMODE lockmode, bool missing_ok);
+ List *object, Relation *relp,
+ LOCKMODE lockmode, bool missing_ok);
static ObjectAddress get_object_address_attrdef(ObjectType objtype,
- List *object, Relation *relp, LOCKMODE lockmode,
- bool missing_ok);
+ List *object, Relation *relp, LOCKMODE lockmode,
+ bool missing_ok);
static ObjectAddress get_object_address_type(ObjectType objtype,
- TypeName *typename, bool missing_ok);
+ TypeName *typename, bool missing_ok);
static ObjectAddress get_object_address_opcf(ObjectType objtype, List *object,
- bool missing_ok);
+ bool missing_ok);
static ObjectAddress get_object_address_opf_member(ObjectType objtype,
- List *object, bool missing_ok);
+ List *object, bool missing_ok);
static ObjectAddress get_object_address_usermapping(List *object,
- bool missing_ok);
+ bool missing_ok);
static ObjectAddress get_object_address_publication_rel(List *object,
- Relation *relp,
- bool missing_ok);
+ Relation *relp,
+ bool missing_ok);
static ObjectAddress get_object_address_defacl(List *object,
- bool missing_ok);
+ bool missing_ok);
static const ObjectPropertyType *get_object_property_data(Oid class_id);
static void getRelationDescription(StringInfo buffer, Oid relid);
static void getOpFamilyDescription(StringInfo buffer, Oid opfid);
static void getRelationTypeDescription(StringInfo buffer, Oid relid,
- int32 objectSubId);
+ int32 objectSubId);
static void getProcedureTypeDescription(StringInfo buffer, Oid procid);
static void getConstraintTypeDescription(StringInfo buffer, Oid constroid);
static void getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **object);
static Oid get_partition_parent_worker(Relation inhRel, Oid relid);
static void get_partition_ancestors_worker(Relation inhRel, Oid relid,
- List **ancestors);
+ List **ancestors);
/*
* get_partition_parent
#include "utils/syscache.h"
-static Oid lookup_agg_function(List *fnName, int nargs, Oid *input_types,
- Oid variadicArgType,
- Oid *rettype);
+static Oid lookup_agg_function(List *fnName, int nargs, Oid *input_types,
+ Oid variadicArgType,
+ Oid *rettype);
/*
#include "utils/syscache.h"
-static Oid OperatorGet(const char *operatorName,
- Oid operatorNamespace,
- Oid leftObjectId,
- Oid rightObjectId,
- bool *defined);
-
-static Oid OperatorLookup(List *operatorName,
- Oid leftObjectId,
- Oid rightObjectId,
- bool *defined);
-
-static Oid OperatorShellMake(const char *operatorName,
- Oid operatorNamespace,
- Oid leftTypeId,
- Oid rightTypeId);
-
-static Oid get_other_operator(List *otherOp,
- Oid otherLeftTypeId, Oid otherRightTypeId,
- const char *operatorName, Oid operatorNamespace,
- Oid leftTypeId, Oid rightTypeId,
- bool isCommutator);
+static Oid OperatorGet(const char *operatorName,
+ Oid operatorNamespace,
+ Oid leftObjectId,
+ Oid rightObjectId,
+ bool *defined);
+
+static Oid OperatorLookup(List *operatorName,
+ Oid leftObjectId,
+ Oid rightObjectId,
+ bool *defined);
+
+static Oid OperatorShellMake(const char *operatorName,
+ Oid operatorNamespace,
+ Oid leftTypeId,
+ Oid rightTypeId);
+
+static Oid get_other_operator(List *otherOp,
+ Oid otherLeftTypeId, Oid otherRightTypeId,
+ const char *operatorName, Oid operatorNamespace,
+ Oid leftTypeId, Oid rightTypeId,
+ bool isCommutator);
/*
} parse_error_callback_arg;
static void sql_function_parse_error_callback(void *arg);
-static int match_prosrc_to_query(const char *prosrc, const char *queryText,
- int cursorpos);
+static int match_prosrc_to_query(const char *prosrc, const char *queryText,
+ int cursorpos);
static bool match_prosrc_to_literal(const char *prosrc, const char *literal,
- int cursorpos, int *newcursorpos);
+ int cursorpos, int *newcursorpos);
/* ----------------------------------------------------------------
static void getOidListDiff(Oid *list1, int *nlist1, Oid *list2, int *nlist2);
static Oid classIdGetDbId(Oid classId);
static void shdepChangeDep(Relation sdepRel,
- Oid classid, Oid objid, int32 objsubid,
- Oid refclassid, Oid refobjid,
- SharedDependencyType deptype);
+ Oid classid, Oid objid, int32 objsubid,
+ Oid refclassid, Oid refobjid,
+ SharedDependencyType deptype);
static void shdepAddDependency(Relation sdepRel,
- Oid classId, Oid objectId, int32 objsubId,
- Oid refclassId, Oid refobjId,
- SharedDependencyType deptype);
+ Oid classId, Oid objectId, int32 objsubId,
+ Oid refclassId, Oid refobjId,
+ SharedDependencyType deptype);
static void shdepDropDependency(Relation sdepRel,
- Oid classId, Oid objectId, int32 objsubId,
- bool drop_subobjects,
- Oid refclassId, Oid refobjId,
- SharedDependencyType deptype);
+ Oid classId, Oid objectId, int32 objsubId,
+ bool drop_subobjects,
+ Oid refclassId, Oid refobjId,
+ SharedDependencyType deptype);
static void storeObjectDescription(StringInfo descs,
- SharedDependencyObjectType type,
- ObjectAddress *object,
- SharedDependencyType deptype,
- int count);
+ SharedDependencyObjectType type,
+ ObjectAddress *object,
+ SharedDependencyType deptype,
+ int count);
static bool isSharedObjectPinned(Oid classId, Oid objectId, Relation sdepRel);
Oid binary_upgrade_next_toast_pg_type_oid = InvalidOid;
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions,
- LOCKMODE lockmode, bool check);
+ LOCKMODE lockmode, bool check);
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
- Datum reloptions, LOCKMODE lockmode, bool check);
+ Datum reloptions, LOCKMODE lockmode, bool check);
static bool needs_toast_table(Relation rel);
static void do_analyze_rel(Relation onerel,
- VacuumParams *params, List *va_cols,
- AcquireSampleRowsFunc acquirefunc, BlockNumber relpages,
- bool inh, bool in_outer_xact, int elevel);
+ VacuumParams *params, List *va_cols,
+ AcquireSampleRowsFunc acquirefunc, BlockNumber relpages,
+ bool inh, bool in_outer_xact, int elevel);
static void compute_index_stats(Relation onerel, double totalrows,
- AnlIndexData *indexdata, int nindexes,
- HeapTuple *rows, int numrows,
- MemoryContext col_context);
+ AnlIndexData *indexdata, int nindexes,
+ HeapTuple *rows, int numrows,
+ MemoryContext col_context);
static VacAttrStats *examine_attribute(Relation onerel, int attnum,
- Node *index_expr);
-static int acquire_sample_rows(Relation onerel, int elevel,
- HeapTuple *rows, int targrows,
- double *totalrows, double *totaldeadrows);
+ Node *index_expr);
+static int acquire_sample_rows(Relation onerel, int elevel,
+ HeapTuple *rows, int targrows,
+ double *totalrows, double *totaldeadrows);
static int compare_rows(const void *a, const void *b);
-static int acquire_inherited_sample_rows(Relation onerel, int elevel,
- HeapTuple *rows, int targrows,
- double *totalrows, double *totaldeadrows);
+static int acquire_inherited_sample_rows(Relation onerel, int elevel,
+ HeapTuple *rows, int targrows,
+ double *totalrows, double *totaldeadrows);
static void update_attstats(Oid relid, bool inh,
- int natts, VacAttrStats **vacattrstats);
+ int natts, VacAttrStats **vacattrstats);
static Datum std_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
static Datum ind_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
static void compute_trivial_stats(VacAttrStatsP stats,
- AnalyzeAttrFetchFunc fetchfunc,
- int samplerows,
- double totalrows);
+ AnalyzeAttrFetchFunc fetchfunc,
+ int samplerows,
+ double totalrows);
static void compute_distinct_stats(VacAttrStatsP stats,
- AnalyzeAttrFetchFunc fetchfunc,
- int samplerows,
- double totalrows);
+ AnalyzeAttrFetchFunc fetchfunc,
+ int samplerows,
+ double totalrows);
static void compute_scalar_stats(VacAttrStatsP stats,
- AnalyzeAttrFetchFunc fetchfunc,
- int samplerows,
- double totalrows);
+ AnalyzeAttrFetchFunc fetchfunc,
+ int samplerows,
+ double totalrows);
static int compare_scalars(const void *a, const void *b, void *arg);
static int compare_mcvs(const void *a, const void *b);
-static int analyze_mcv_list(int *mcv_counts,
- int num_mcv,
- double stadistinct,
- double stanullfrac,
- int samplerows,
- double totalrows);
+static int analyze_mcv_list(int *mcv_counts,
+ int num_mcv,
+ double stadistinct,
+ double stanullfrac,
+ int samplerows,
+ double totalrows);
/*
static bool SignalBackends(void);
static void asyncQueueReadAllNotifications(void);
static bool asyncQueueProcessPageEntries(volatile QueuePosition *current,
- QueuePosition stop,
- char *page_buffer,
- Snapshot snapshot);
+ QueuePosition stop,
+ char *page_buffer,
+ Snapshot snapshot);
static void asyncQueueAdvanceTail(void);
static void ProcessIncomingNotify(void);
static bool AsyncExistsPendingNotify(const char *channel, const char *payload);
static void rebuild_relation(Relation OldHeap, Oid indexOid, bool verbose);
static void copy_table_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
- bool verbose, bool *pSwapToastByContent,
- TransactionId *pFreezeXid, MultiXactId *pCutoffMulti);
+ bool verbose, bool *pSwapToastByContent,
+ TransactionId *pFreezeXid, MultiXactId *pCutoffMulti);
static List *get_tables_to_cluster(MemoryContext cluster_context);
/* non-export function prototypes */
static CopyState BeginCopy(ParseState *pstate, bool is_from, Relation rel,
- RawStmt *raw_query, Oid queryRelId, List *attnamelist,
- List *options);
+ RawStmt *raw_query, Oid queryRelId, List *attnamelist,
+ List *options);
static void EndCopy(CopyState cstate);
static void ClosePipeToProgram(CopyState cstate);
static CopyState BeginCopyTo(ParseState *pstate, Relation rel, RawStmt *query,
- Oid queryRelId, const char *filename, bool is_program,
- List *attnamelist, List *options);
+ Oid queryRelId, const char *filename, bool is_program,
+ List *attnamelist, List *options);
static void EndCopyTo(CopyState cstate);
static uint64 DoCopyTo(CopyState cstate);
static uint64 CopyTo(CopyState cstate);
static int CopyReadAttributesText(CopyState cstate);
static int CopyReadAttributesCSV(CopyState cstate);
static Datum CopyReadBinaryAttribute(CopyState cstate,
- int column_no, FmgrInfo *flinfo,
- Oid typioparam, int32 typmod,
- bool *isnull);
+ int column_no, FmgrInfo *flinfo,
+ Oid typioparam, int32 typmod,
+ bool *isnull);
static void CopyAttributeOutText(CopyState cstate, char *string);
static void CopyAttributeOutCSV(CopyState cstate, char *string,
- bool use_quote, bool single_attr);
+ bool use_quote, bool single_attr);
static List *CopyGetAttnums(TupleDesc tupDesc, Relation rel,
- List *attnamelist);
+ List *attnamelist);
static char *limit_printout_length(const char *str);
/* Low-level communications functions */
static void CopySendString(CopyState cstate, const char *str);
static void CopySendChar(CopyState cstate, char c);
static void CopySendEndOfRow(CopyState cstate);
-static int CopyGetData(CopyState cstate, void *databuf,
- int minread, int maxread);
+static int CopyGetData(CopyState cstate, void *databuf,
+ int minread, int maxread);
static void CopySendInt32(CopyState cstate, int32 val);
static bool CopyGetInt32(CopyState cstate, int32 *val);
static void CopySendInt16(CopyState cstate, int16 val);
static void movedb(const char *dbname, const char *tblspcname);
static void movedb_failure_callback(int code, Datum arg);
static bool get_db_info(const char *name, LOCKMODE lockmode,
- Oid *dbIdP, Oid *ownerIdP,
- int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP,
- Oid *dbLastSysOidP, TransactionId *dbFrozenXidP,
- MultiXactId *dbMinMultiP,
- Oid *dbTablespace, char **dbCollate, char **dbCtype);
+ Oid *dbIdP, Oid *ownerIdP,
+ int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP,
+ Oid *dbLastSysOidP, TransactionId *dbFrozenXidP,
+ MultiXactId *dbMinMultiP,
+ Oid *dbTablespace, char **dbCollate, char **dbCtype);
static bool have_createdb_privilege(void);
static void remove_dbtablespaces(Oid db_id);
static bool check_db_file_conflict(Oid db_id);
static void does_not_exist_skipping(ObjectType objtype,
- Node *object);
+ Node *object);
static bool owningrel_does_not_exist_skipping(List *object,
- const char **msg, char **name);
+ const char **msg, char **name);
static bool schema_does_not_exist_skipping(List *object,
- const char **msg, char **name);
+ const char **msg, char **name);
static bool type_in_list_does_not_exist_skipping(List *typenames,
- const char **msg, char **name);
+ const char **msg, char **name);
/*
} SQLDropObject;
static void AlterEventTriggerOwner_internal(Relation rel,
- HeapTuple tup,
- Oid newOwnerId);
+ HeapTuple tup,
+ Oid newOwnerId);
static event_trigger_command_tag_check_result check_ddl_tag(const char *tag);
static event_trigger_command_tag_check_result check_table_rewrite_ddl_tag(
- const char *tag);
+ const char *tag);
static void error_duplicate_filter_variable(const char *defname);
static Datum filter_list_to_array(List *filterlist);
-static Oid insert_event_trigger_tuple(const char *trigname, const char *eventname,
- Oid evtOwner, Oid funcoid, List *tags);
+static Oid insert_event_trigger_tuple(const char *trigname, const char *eventname,
+ Oid evtOwner, Oid funcoid, List *tags);
static void validate_ddl_tags(const char *filtervar, List *taglist);
static void validate_table_rewrite_tags(const char *filtervar, List *taglist);
static void EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata);
#define X_NOWHITESPACE 4
static void ExplainOneQuery(Query *query, int cursorOptions,
- IntoClause *into, ExplainState *es,
- const char *queryString, ParamListInfo params,
- QueryEnvironment *queryEnv);
+ IntoClause *into, ExplainState *es,
+ const char *queryString, ParamListInfo params,
+ QueryEnvironment *queryEnv);
static void report_triggers(ResultRelInfo *rInfo, bool show_relname,
- ExplainState *es);
+ ExplainState *es);
static double elapsed_time(instr_time *starttime);
static bool ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used);
static void ExplainNode(PlanState *planstate, List *ancestors,
- const char *relationship, const char *plan_name,
- ExplainState *es);
+ const char *relationship, const char *plan_name,
+ ExplainState *es);
static void show_plan_tlist(PlanState *planstate, List *ancestors,
- ExplainState *es);
+ ExplainState *es);
static void show_expression(Node *node, const char *qlabel,
- PlanState *planstate, List *ancestors,
- bool useprefix, ExplainState *es);
+ PlanState *planstate, List *ancestors,
+ bool useprefix, ExplainState *es);
static void show_qual(List *qual, const char *qlabel,
- PlanState *planstate, List *ancestors,
- bool useprefix, ExplainState *es);
+ PlanState *planstate, List *ancestors,
+ bool useprefix, ExplainState *es);
static void show_scan_qual(List *qual, const char *qlabel,
- PlanState *planstate, List *ancestors,
- ExplainState *es);
+ PlanState *planstate, List *ancestors,
+ ExplainState *es);
static void show_upper_qual(List *qual, const char *qlabel,
- PlanState *planstate, List *ancestors,
- ExplainState *es);
+ PlanState *planstate, List *ancestors,
+ ExplainState *es);
static void show_sort_keys(SortState *sortstate, List *ancestors,
- ExplainState *es);
+ ExplainState *es);
static void show_merge_append_keys(MergeAppendState *mstate, List *ancestors,
- ExplainState *es);
+ ExplainState *es);
static void show_agg_keys(AggState *astate, List *ancestors,
- ExplainState *es);
+ ExplainState *es);
static void show_grouping_sets(PlanState *planstate, Agg *agg,
- List *ancestors, ExplainState *es);
+ List *ancestors, ExplainState *es);
static void show_grouping_set_keys(PlanState *planstate,
- Agg *aggnode, Sort *sortnode,
- List *context, bool useprefix,
- List *ancestors, ExplainState *es);
+ Agg *aggnode, Sort *sortnode,
+ List *context, bool useprefix,
+ List *ancestors, ExplainState *es);
static void show_group_keys(GroupState *gstate, List *ancestors,
- ExplainState *es);
+ ExplainState *es);
static void show_sort_group_keys(PlanState *planstate, const char *qlabel,
- int nkeys, AttrNumber *keycols,
- Oid *sortOperators, Oid *collations, bool *nullsFirst,
- List *ancestors, ExplainState *es);
+ int nkeys, AttrNumber *keycols,
+ Oid *sortOperators, Oid *collations, bool *nullsFirst,
+ List *ancestors, ExplainState *es);
static void show_sortorder_options(StringInfo buf, Node *sortexpr,
- Oid sortOperator, Oid collation, bool nullsFirst);
+ Oid sortOperator, Oid collation, bool nullsFirst);
static void show_tablesample(TableSampleClause *tsc, PlanState *planstate,
- List *ancestors, ExplainState *es);
+ List *ancestors, ExplainState *es);
static void show_sort_info(SortState *sortstate, ExplainState *es);
static void show_hash_info(HashState *hashstate, ExplainState *es);
static void show_tidbitmap_info(BitmapHeapScanState *planstate,
- ExplainState *es);
+ ExplainState *es);
static void show_instrumentation_count(const char *qlabel, int which,
- PlanState *planstate, ExplainState *es);
+ PlanState *planstate, ExplainState *es);
static void show_foreignscan_info(ForeignScanState *fsstate, ExplainState *es);
static void show_eval_params(Bitmapset *bms_params, ExplainState *es);
static const char *explain_get_index_name(Oid indexId);
static void show_buffer_usage(ExplainState *es, const BufferUsage *usage);
static void ExplainIndexScanDetails(Oid indexid, ScanDirection indexorderdir,
- ExplainState *es);
+ ExplainState *es);
static void ExplainScanTarget(Scan *plan, ExplainState *es);
static void ExplainModifyTarget(ModifyTable *plan, ExplainState *es);
static void ExplainTargetRel(Plan *plan, Index rti, ExplainState *es);
static void show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
- ExplainState *es);
+ ExplainState *es);
static void ExplainMemberNodes(PlanState **planstates, int nsubnodes,
- int nplans, List *ancestors, ExplainState *es);
+ int nplans, List *ancestors, ExplainState *es);
static void ExplainSubPlans(List *plans, List *ancestors,
- const char *relationship, ExplainState *es);
+ const char *relationship, ExplainState *es);
static void ExplainCustomChildren(CustomScanState *css,
- List *ancestors, ExplainState *es);
+ List *ancestors, ExplainState *es);
static void ExplainProperty(const char *qlabel, const char *unit,
- const char *value, bool numeric, ExplainState *es);
+ const char *value, bool numeric, ExplainState *es);
static void ExplainDummyGroup(const char *objtype, const char *labelname,
- ExplainState *es);
+ ExplainState *es);
static void ExplainXMLTag(const char *tagname, int flags, ExplainState *es);
static void ExplainJSONLineEnding(ExplainState *es);
static void ExplainYAMLLineStarting(ExplainState *es);
/* Local functions */
static List *find_update_path(List *evi_list,
- ExtensionVersionInfo *evi_start,
- ExtensionVersionInfo *evi_target,
- bool reject_indirect,
- bool reinitialize);
-static Oid get_required_extension(char *reqExtensionName,
- char *extensionName,
- char *origSchemaName,
- bool cascade,
- List *parents,
- bool is_create);
+ ExtensionVersionInfo *evi_start,
+ ExtensionVersionInfo *evi_target,
+ bool reject_indirect,
+ bool reinitialize);
+static Oid get_required_extension(char *reqExtensionName,
+ char *extensionName,
+ char *origSchemaName,
+ bool cascade,
+ List *parents,
+ bool is_create);
static void get_available_versions_for_extension(ExtensionControlFile *pcontrol,
- Tuplestorestate *tupstore,
- TupleDesc tupdesc);
+ Tuplestorestate *tupstore,
+ TupleDesc tupdesc);
static Datum convert_requires_to_datum(List *requires);
static void ApplyExtensionUpdates(Oid extensionOid,
- ExtensionControlFile *pcontrol,
- const char *initialVersion,
- List *updateVersions,
- char *origSchemaName,
- bool cascade,
- bool is_create);
+ ExtensionControlFile *pcontrol,
+ const char *initialVersion,
+ List *updateVersions,
+ char *origSchemaName,
+ bool cascade,
+ bool is_create);
static char *read_whole_file(const char *filename, int *length);
/* non-export function prototypes */
static void CheckPredicate(Expr *predicate);
static void ComputeIndexAttrs(IndexInfo *indexInfo,
- Oid *typeOidP,
- Oid *collationOidP,
- Oid *classOidP,
- int16 *colOptionP,
- List *attList,
- List *exclusionOpNames,
- Oid relId,
- const char *accessMethodName, Oid accessMethodId,
- bool amcanorder,
- bool isconstraint);
+ Oid *typeOidP,
+ Oid *collationOidP,
+ Oid *classOidP,
+ int16 *colOptionP,
+ List *attList,
+ List *exclusionOpNames,
+ Oid relId,
+ const char *accessMethodName, Oid accessMethodId,
+ bool amcanorder,
+ bool isconstraint);
static char *ChooseIndexName(const char *tabname, Oid namespaceId,
- List *colnames, List *exclusionOpNames,
- bool primary, bool isconstraint);
+ List *colnames, List *exclusionOpNames,
+ bool primary, bool isconstraint);
static char *ChooseIndexNameAddition(List *colnames);
static List *ChooseIndexColumnNames(List *indexElems);
static void RangeVarCallbackForReindexIndex(const RangeVar *relation,
- Oid relId, Oid oldRelId, void *arg);
+ Oid relId, Oid oldRelId, void *arg);
static bool ReindexRelationConcurrently(Oid relationOid, int options);
static void ReindexPartitionedIndex(Relation parentIdx);
static void update_relispartition(Oid relationId, bool newval);
static void LockTableRecurse(Oid reloid, LOCKMODE lockmode, bool nowait, Oid userid);
static AclResult LockTableAclCheck(Oid relid, LOCKMODE lockmode, Oid userid);
static void RangeVarCallbackForLockTable(const RangeVar *rv, Oid relid,
- Oid oldrelid, void *arg);
+ Oid oldrelid, void *arg);
static void LockViewRecurse(Oid reloid, LOCKMODE lockmode, bool nowait, List *ancestor_views);
/*
static void transientrel_shutdown(DestReceiver *self);
static void transientrel_destroy(DestReceiver *self);
static uint64 refresh_matview_datafill(DestReceiver *dest, Query *query,
- const char *queryString);
+ const char *queryString);
static char *make_temptable_name_n(char *tempname, int n);
static void refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
- int save_sec_context);
+ int save_sec_context);
static void refresh_by_heap_swap(Oid matviewOid, Oid OIDNewHeap, char relpersistence);
static bool is_usable_unique_index(Relation indexRel);
static void OpenMatViewIncrementalMaintenance(void);
static void AlterOpFamilyAdd(AlterOpFamilyStmt *stmt,
- Oid amoid, Oid opfamilyoid,
- int maxOpNumber, int maxProcNumber,
- List *items);
+ Oid amoid, Oid opfamilyoid,
+ int maxOpNumber, int maxProcNumber,
+ List *items);
static void AlterOpFamilyDrop(AlterOpFamilyStmt *stmt,
- Oid amoid, Oid opfamilyoid,
- int maxOpNumber, int maxProcNumber,
- List *items);
+ Oid amoid, Oid opfamilyoid,
+ int maxOpNumber, int maxProcNumber,
+ List *items);
static void processTypesSpec(List *args, Oid *lefttype, Oid *righttype);
static void assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid);
static void assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid);
static void addFamilyMember(List **list, OpFamilyMember *member, bool isProc);
static void storeOperators(List *opfamilyname, Oid amoid,
- Oid opfamilyoid, Oid opclassoid,
- List *operators, bool isAdd);
+ Oid opfamilyoid, Oid opclassoid,
+ List *operators, bool isAdd);
static void storeProcedures(List *opfamilyname, Oid amoid,
- Oid opfamilyoid, Oid opclassoid,
- List *procedures, bool isAdd);
+ Oid opfamilyoid, Oid opclassoid,
+ List *procedures, bool isAdd);
static void dropOperators(List *opfamilyname, Oid amoid, Oid opfamilyoid,
- List *operators);
+ List *operators);
static void dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
- List *procedures);
+ List *procedures);
/*
* OpFamilyCacheLookup
#include "utils/syscache.h"
static void RangeVarCallbackForPolicy(const RangeVar *rv,
- Oid relid, Oid oldrelid, void *arg);
+ Oid relid, Oid oldrelid, void *arg);
static char parse_policy_command(const char *cmd_name);
static Datum *policy_role_list_to_array(List *roles, int *num_roles);
static void InitQueryHashTable(void);
static ParamListInfo EvaluateParams(PreparedStatement *pstmt, List *params,
- const char *queryString, EState *estate);
+ const char *queryString, EState *estate);
static Datum build_regtype_array(Oid *param_types, int num_params);
/*
} PLTemplate;
static ObjectAddress create_proc_lang(const char *languageName, bool replace,
- Oid languageOwner, Oid handlerOid, Oid inlineOid,
- Oid valOid, bool trusted);
+ Oid languageOwner, Oid handlerOid, Oid inlineOid,
+ Oid valOid, bool trusted);
static PLTemplate *find_language_template(const char *languageName);
/*
static List *OpenTableList(List *tables);
static void CloseTableList(List *rels);
static void PublicationAddTables(Oid pubid, List *rels, bool if_not_exists,
- AlterPublicationStmt *stmt);
+ AlterPublicationStmt *stmt);
static void PublicationDropTables(Oid pubid, List *rels, bool missing_ok);
static void
static void create_seq_hashtable(void);
static void init_sequence(Oid relid, SeqTable *p_elm, Relation *p_rel);
static Form_pg_sequence_data read_seq_tuple(Relation rel,
- Buffer *buf, HeapTuple seqdatatuple);
+ Buffer *buf, HeapTuple seqdatatuple);
static void init_params(ParseState *pstate, List *options, bool for_identity,
- bool isInit,
- Form_pg_sequence seqform,
- Form_pg_sequence_data seqdataform,
- bool *need_seq_rewrite,
- List **owned_by);
+ bool isInit,
+ Form_pg_sequence seqform,
+ Form_pg_sequence_data seqdataform,
+ bool *need_seq_rewrite,
+ List **owned_by);
static void do_setval(Oid relid, int64 next, bool iscalled);
static void process_owned_by(Relation seqrel, List *owned_by, bool for_identity);
static char *ChooseExtendedStatisticName(const char *name1, const char *name2,
- const char *label, Oid namespaceid);
+ const char *label, Oid namespaceid);
static char *ChooseExtendedStatisticNameAddition(List *exprs);
static void truncate_check_rel(Oid relid, Form_pg_class reltuple);
static void truncate_check_activity(Relation rel);
static void RangeVarCallbackForTruncate(const RangeVar *relation,
- Oid relId, Oid oldRelId, void *arg);
+ Oid relId, Oid oldRelId, void *arg);
static List *MergeAttributes(List *schema, List *supers, char relpersistence,
- bool is_partition, List **supconstr);
+ bool is_partition, List **supconstr);
static bool MergeCheckConstraint(List *constraints, char *name, Node *expr);
static void MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel);
static void MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel);
static void StoreCatalogInheritance(Oid relationId, List *supers,
- bool child_is_partition);
+ bool child_is_partition);
static void StoreCatalogInheritance1(Oid relationId, Oid parentOid,
- int32 seqNumber, Relation inhRelation,
- bool child_is_partition);
+ int32 seqNumber, Relation inhRelation,
+ bool child_is_partition);
static int findAttrByName(const char *attributeName, List *schema);
static void AlterIndexNamespaces(Relation classRel, Relation rel,
- Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved);
+ Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved);
static void AlterSeqNamespaces(Relation classRel, Relation rel,
- Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved,
- LOCKMODE lockmode);
+ Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved,
+ LOCKMODE lockmode);
static ObjectAddress ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd,
- bool recurse, bool recursing, LOCKMODE lockmode);
+ bool recurse, bool recursing, LOCKMODE lockmode);
static ObjectAddress ATExecValidateConstraint(Relation rel, char *constrName,
- bool recurse, bool recursing, LOCKMODE lockmode);
-static int transformColumnNameList(Oid relId, List *colList,
- int16 *attnums, Oid *atttypids);
-static int transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
- List **attnamelist,
- int16 *attnums, Oid *atttypids,
- Oid *opclasses);
-static Oid transformFkeyCheckAttrs(Relation pkrel,
- int numattrs, int16 *attnums,
- Oid *opclasses);
+ bool recurse, bool recursing, LOCKMODE lockmode);
+static int transformColumnNameList(Oid relId, List *colList,
+ int16 *attnums, Oid *atttypids);
+static int transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
+ List **attnamelist,
+ int16 *attnums, Oid *atttypids,
+ Oid *opclasses);
+static Oid transformFkeyCheckAttrs(Relation pkrel,
+ int numattrs, int16 *attnums,
+ Oid *opclasses);
static void checkFkeyPermissions(Relation rel, int16 *attnums, int natts);
static CoercionPathType findFkeyCast(Oid targetTypeId, Oid sourceTypeId,
- Oid *funcid);
+ Oid *funcid);
static void validateCheckConstraint(Relation rel, HeapTuple constrtup);
static void validateForeignKeyConstraint(char *conname,
- Relation rel, Relation pkrel,
- Oid pkindOid, Oid constraintOid);
+ Relation rel, Relation pkrel,
+ Oid pkindOid, Oid constraintOid);
static void ATController(AlterTableStmt *parsetree,
- Relation rel, List *cmds, bool recurse, LOCKMODE lockmode);
+ Relation rel, List *cmds, bool recurse, LOCKMODE lockmode);
static void ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
- bool recurse, bool recursing, LOCKMODE lockmode);
+ bool recurse, bool recursing, LOCKMODE lockmode);
static void ATRewriteCatalogs(List **wqueue, LOCKMODE lockmode);
static void ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
- AlterTableCmd *cmd, LOCKMODE lockmode);
+ AlterTableCmd *cmd, LOCKMODE lockmode);
static void ATRewriteTables(AlterTableStmt *parsetree,
- List **wqueue, LOCKMODE lockmode);
+ List **wqueue, LOCKMODE lockmode);
static void ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode);
static AlteredTableInfo *ATGetQueueEntry(List **wqueue, Relation rel);
static void ATSimplePermissions(Relation rel, int allowed_targets);
static void ATWrongRelkindError(Relation rel, int allowed_targets);
static void ATSimpleRecursion(List **wqueue, Relation rel,
- AlterTableCmd *cmd, bool recurse, LOCKMODE lockmode);
+ AlterTableCmd *cmd, bool recurse, LOCKMODE lockmode);
static void ATTypedTableRecursion(List **wqueue, Relation rel, AlterTableCmd *cmd,
- LOCKMODE lockmode);
+ LOCKMODE lockmode);
static List *find_typed_table_dependencies(Oid typeOid, const char *typeName,
- DropBehavior behavior);
+ DropBehavior behavior);
static void ATPrepAddColumn(List **wqueue, Relation rel, bool recurse, bool recursing,
- bool is_view, AlterTableCmd *cmd, LOCKMODE lockmode);
+ bool is_view, AlterTableCmd *cmd, LOCKMODE lockmode);
static ObjectAddress ATExecAddColumn(List **wqueue, AlteredTableInfo *tab,
- Relation rel, ColumnDef *colDef,
- bool recurse, bool recursing,
- bool if_not_exists, LOCKMODE lockmode);
+ Relation rel, ColumnDef *colDef,
+ bool recurse, bool recursing,
+ bool if_not_exists, LOCKMODE lockmode);
static bool check_for_column_name_collision(Relation rel, const char *colname,
- bool if_not_exists);
+ bool if_not_exists);
static void add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid);
static void add_column_collation_dependency(Oid relid, int32 attnum, Oid collid);
static void ATPrepDropNotNull(Relation rel, bool recurse, bool recursing);
static ObjectAddress ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode);
static void ATPrepSetNotNull(List **wqueue, Relation rel,
- AlterTableCmd *cmd, bool recurse, bool recursing,
- LOCKMODE lockmode);
+ AlterTableCmd *cmd, bool recurse, bool recursing,
+ LOCKMODE lockmode);
static ObjectAddress ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
- const char *colName, LOCKMODE lockmode);
+ const char *colName, LOCKMODE lockmode);
static void ATExecCheckNotNull(AlteredTableInfo *tab, Relation rel,
- const char *colName, LOCKMODE lockmode);
+ const char *colName, LOCKMODE lockmode);
static bool NotNullImpliedByRelConstraints(Relation rel, Form_pg_attribute attr);
static bool ConstraintImpliedByRelConstraint(Relation scanrel,
- List *partConstraint, List *existedConstraints);
+ List *partConstraint, List *existedConstraints);
static ObjectAddress ATExecColumnDefault(Relation rel, const char *colName,
- Node *newDefault, LOCKMODE lockmode);
+ Node *newDefault, LOCKMODE lockmode);
static ObjectAddress ATExecAddIdentity(Relation rel, const char *colName,
- Node *def, LOCKMODE lockmode);
+ Node *def, LOCKMODE lockmode);
static ObjectAddress ATExecSetIdentity(Relation rel, const char *colName,
- Node *def, LOCKMODE lockmode);
+ Node *def, LOCKMODE lockmode);
static ObjectAddress ATExecDropIdentity(Relation rel, const char *colName, bool missing_ok, LOCKMODE lockmode);
static void ATPrepSetStatistics(Relation rel, const char *colName, int16 colNum,
- Node *newValue, LOCKMODE lockmode);
+ Node *newValue, LOCKMODE lockmode);
static ObjectAddress ATExecSetStatistics(Relation rel, const char *colName, int16 colNum,
- Node *newValue, LOCKMODE lockmode);
+ Node *newValue, LOCKMODE lockmode);
static ObjectAddress ATExecSetOptions(Relation rel, const char *colName,
- Node *options, bool isReset, LOCKMODE lockmode);
+ Node *options, bool isReset, LOCKMODE lockmode);
static ObjectAddress ATExecSetStorage(Relation rel, const char *colName,
- Node *newValue, LOCKMODE lockmode);
+ Node *newValue, LOCKMODE lockmode);
static void ATPrepDropColumn(List **wqueue, Relation rel, bool recurse, bool recursing,
- AlterTableCmd *cmd, LOCKMODE lockmode);
+ AlterTableCmd *cmd, LOCKMODE lockmode);
static ObjectAddress ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
- DropBehavior behavior,
- bool recurse, bool recursing,
- bool missing_ok, LOCKMODE lockmode);
+ DropBehavior behavior,
+ bool recurse, bool recursing,
+ bool missing_ok, LOCKMODE lockmode);
static ObjectAddress ATExecAddIndex(AlteredTableInfo *tab, Relation rel,
- IndexStmt *stmt, bool is_rebuild, LOCKMODE lockmode);
+ IndexStmt *stmt, bool is_rebuild, LOCKMODE lockmode);
static ObjectAddress ATExecAddConstraint(List **wqueue,
- AlteredTableInfo *tab, Relation rel,
- Constraint *newConstraint, bool recurse, bool is_readd,
- LOCKMODE lockmode);
+ AlteredTableInfo *tab, Relation rel,
+ Constraint *newConstraint, bool recurse, bool is_readd,
+ LOCKMODE lockmode);
static char *ChooseForeignKeyConstraintNameAddition(List *colnames);
static ObjectAddress ATExecAddIndexConstraint(AlteredTableInfo *tab, Relation rel,
- IndexStmt *stmt, LOCKMODE lockmode);
+ IndexStmt *stmt, LOCKMODE lockmode);
static ObjectAddress ATAddCheckConstraint(List **wqueue,
- AlteredTableInfo *tab, Relation rel,
- Constraint *constr,
- bool recurse, bool recursing, bool is_readd,
- LOCKMODE lockmode);
+ AlteredTableInfo *tab, Relation rel,
+ Constraint *constr,
+ bool recurse, bool recursing, bool is_readd,
+ LOCKMODE lockmode);
static ObjectAddress ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab,
- Relation rel, Constraint *fkconstraint, Oid parentConstr,
- bool recurse, bool recursing,
- LOCKMODE lockmode);
+ Relation rel, Constraint *fkconstraint, Oid parentConstr,
+ bool recurse, bool recursing,
+ LOCKMODE lockmode);
static ObjectAddress addFkRecurseReferenced(List **wqueue, Constraint *fkconstraint,
- Relation rel, Relation pkrel, Oid indexOid, Oid parentConstr,
- int numfks, int16 *pkattnum, int16 *fkattnum,
- Oid *pfeqoperators, Oid *ppeqoperators, Oid *ffeqoperators,
- bool old_check_ok);
+ Relation rel, Relation pkrel, Oid indexOid, Oid parentConstr,
+ int numfks, int16 *pkattnum, int16 *fkattnum,
+ Oid *pfeqoperators, Oid *ppeqoperators, Oid *ffeqoperators,
+ bool old_check_ok);
static void addFkRecurseReferencing(List **wqueue, Constraint *fkconstraint,
- Relation rel, Relation pkrel, Oid indexOid, Oid parentConstr,
- int numfks, int16 *pkattnum, int16 *fkattnum,
- Oid *pfeqoperators, Oid *ppeqoperators, Oid *ffeqoperators,
- bool old_check_ok, LOCKMODE lockmode);
+ Relation rel, Relation pkrel, Oid indexOid, Oid parentConstr,
+ int numfks, int16 *pkattnum, int16 *fkattnum,
+ Oid *pfeqoperators, Oid *ppeqoperators, Oid *ffeqoperators,
+ bool old_check_ok, LOCKMODE lockmode);
static void CloneForeignKeyConstraints(List **wqueue, Relation parentRel,
- Relation partitionRel);
+ Relation partitionRel);
static void CloneFkReferenced(Relation parentRel, Relation partitionRel);
static void CloneFkReferencing(List **wqueue, Relation parentRel,
- Relation partRel);
+ Relation partRel);
static void createForeignKeyCheckTriggers(Oid myRelOid, Oid refRelOid,
- Constraint *fkconstraint, Oid constraintOid,
- Oid indexOid);
+ Constraint *fkconstraint, Oid constraintOid,
+ Oid indexOid);
static void createForeignKeyActionTriggers(Relation rel, Oid refRelOid,
- Constraint *fkconstraint, Oid constraintOid,
- Oid indexOid);
+ Constraint *fkconstraint, Oid constraintOid,
+ Oid indexOid);
static bool tryAttachPartitionForeignKey(ForeignKeyCacheInfo *fk,
- Oid partRelid,
- Oid parentConstrOid, int numfks,
- AttrNumber *mapped_conkey, AttrNumber *confkey,
- Oid *conpfeqop);
+ Oid partRelid,
+ Oid parentConstrOid, int numfks,
+ AttrNumber *mapped_conkey, AttrNumber *confkey,
+ Oid *conpfeqop);
static void ATExecDropConstraint(Relation rel, const char *constrName,
- DropBehavior behavior,
- bool recurse, bool recursing,
- bool missing_ok, LOCKMODE lockmode);
+ DropBehavior behavior,
+ bool recurse, bool recursing,
+ bool missing_ok, LOCKMODE lockmode);
static void ATPrepAlterColumnType(List **wqueue,
- AlteredTableInfo *tab, Relation rel,
- bool recurse, bool recursing,
- AlterTableCmd *cmd, LOCKMODE lockmode);
+ AlteredTableInfo *tab, Relation rel,
+ bool recurse, bool recursing,
+ AlterTableCmd *cmd, LOCKMODE lockmode);
static bool ATColumnChangeRequiresRewrite(Node *expr, AttrNumber varattno);
static ObjectAddress ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
- AlterTableCmd *cmd, LOCKMODE lockmode);
+ AlterTableCmd *cmd, LOCKMODE lockmode);
static ObjectAddress ATExecAlterColumnGenericOptions(Relation rel, const char *colName,
- List *options, LOCKMODE lockmode);
+ List *options, LOCKMODE lockmode);
static void ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab,
- LOCKMODE lockmode);
+ LOCKMODE lockmode);
static void ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId,
- char *cmd, List **wqueue, LOCKMODE lockmode,
- bool rewrite);
+ char *cmd, List **wqueue, LOCKMODE lockmode,
+ bool rewrite);
static void RebuildConstraintComment(AlteredTableInfo *tab, int pass,
- Oid objid, Relation rel, List *domname,
- const char *conname);
+ Oid objid, Relation rel, List *domname,
+ const char *conname);
static void TryReuseIndex(Oid oldId, IndexStmt *stmt);
static void TryReuseForeignKey(Oid oldId, Constraint *con);
static void change_owner_fix_column_acls(Oid relationOid,
- Oid oldOwnerId, Oid newOwnerId);
+ Oid oldOwnerId, Oid newOwnerId);
static void change_owner_recurse_to_sequences(Oid relationOid,
- Oid newOwnerId, LOCKMODE lockmode);
+ Oid newOwnerId, LOCKMODE lockmode);
static ObjectAddress ATExecClusterOn(Relation rel, const char *indexName,
- LOCKMODE lockmode);
+ LOCKMODE lockmode);
static void ATExecDropCluster(Relation rel, LOCKMODE lockmode);
static bool ATPrepChangePersistence(Relation rel, bool toLogged);
static void ATPrepSetTableSpace(AlteredTableInfo *tab, Relation rel,
- const char *tablespacename, LOCKMODE lockmode);
+ const char *tablespacename, LOCKMODE lockmode);
static void ATExecSetTableSpace(Oid tableOid, Oid newTableSpace, LOCKMODE lockmode);
static void ATExecSetTableSpaceNoStorage(Relation rel, Oid newTableSpace);
static void ATExecSetRelOptions(Relation rel, List *defList,
- AlterTableType operation,
- LOCKMODE lockmode);
+ AlterTableType operation,
+ LOCKMODE lockmode);
static void ATExecEnableDisableTrigger(Relation rel, const char *trigname,
- char fires_when, bool skip_system, LOCKMODE lockmode);
+ char fires_when, bool skip_system, LOCKMODE lockmode);
static void ATExecEnableDisableRule(Relation rel, const char *rulename,
- char fires_when, LOCKMODE lockmode);
+ char fires_when, LOCKMODE lockmode);
static void ATPrepAddInherit(Relation child_rel);
static ObjectAddress ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode);
static ObjectAddress ATExecDropInherit(Relation rel, RangeVar *parent, LOCKMODE lockmode);
static void drop_parent_dependency(Oid relid, Oid refclassid, Oid refobjid,
- DependencyType deptype);
+ DependencyType deptype);
static ObjectAddress ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode);
static void ATExecDropOf(Relation rel, LOCKMODE lockmode);
static void ATExecReplicaIdentity(Relation rel, ReplicaIdentityStmt *stmt, LOCKMODE lockmode);
static const char *storage_name(char c);
static void RangeVarCallbackForDropRelation(const RangeVar *rel, Oid relOid,
- Oid oldRelOid, void *arg);
+ Oid oldRelOid, void *arg);
static void RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid,
- Oid oldrelid, void *arg);
+ Oid oldrelid, void *arg);
static PartitionSpec *transformPartitionSpec(Relation rel, PartitionSpec *partspec, char *strategy);
static void ComputePartitionAttrs(ParseState *pstate, Relation rel, List *partParams, AttrNumber *partattrs,
- List **partexprs, Oid *partopclass, Oid *partcollation, char strategy);
+ List **partexprs, Oid *partopclass, Oid *partcollation, char strategy);
static void CreateInheritance(Relation child_rel, Relation parent_rel);
static void RemoveInheritance(Relation child_rel, Relation parent_rel);
static ObjectAddress ATExecAttachPartition(List **wqueue, Relation rel,
- PartitionCmd *cmd);
+ PartitionCmd *cmd);
static void AttachPartitionEnsureIndexes(Relation rel, Relation attachrel);
static void QueuePartitionConstraintValidation(List **wqueue, Relation scanrel,
- List *partConstraint,
- bool validate_default);
+ List *partConstraint,
+ bool validate_default);
static void CloneRowTriggersToPartition(Relation parent, Relation partition);
static ObjectAddress ATExecDetachPartition(Relation rel, RangeVar *name);
static ObjectAddress ATExecAttachPartitionIdx(List **wqueue, Relation rel,
- RangeVar *name);
+ RangeVar *name);
static void validatePartitionedIndex(Relation partedIdx, Relation partedTbl);
static void refuseDupeIndexAttach(Relation parentIdx, Relation partIdx,
- Relation partitionTbl);
+ Relation partitionTbl);
static List *GetParentedForeignKeyRefs(Relation partition);
static void ATDetachCheckNoForeignKeyRefs(Relation partition);
static void create_tablespace_directories(const char *location,
- const Oid tablespaceoid);
+ const Oid tablespaceoid);
static bool destroy_tablespace_directories(Oid tablespaceoid, bool redo);
static void ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid);
static void SetTriggerFlags(TriggerDesc *trigdesc, Trigger *trigger);
static bool GetTupleForTrigger(EState *estate,
- EPQState *epqstate,
- ResultRelInfo *relinfo,
- ItemPointer tid,
- LockTupleMode lockmode,
- TupleTableSlot *oldslot,
- TupleTableSlot **newSlot);
+ EPQState *epqstate,
+ ResultRelInfo *relinfo,
+ ItemPointer tid,
+ LockTupleMode lockmode,
+ TupleTableSlot *oldslot,
+ TupleTableSlot **newSlot);
static bool TriggerEnabled(EState *estate, ResultRelInfo *relinfo,
- Trigger *trigger, TriggerEvent event,
- Bitmapset *modifiedCols,
- TupleTableSlot *oldslot, TupleTableSlot *newslot);
+ Trigger *trigger, TriggerEvent event,
+ Bitmapset *modifiedCols,
+ TupleTableSlot *oldslot, TupleTableSlot *newslot);
static HeapTuple ExecCallTriggerFunc(TriggerData *trigdata,
- int tgindx,
- FmgrInfo *finfo,
- Instrumentation *instr,
- MemoryContext per_tuple_context);
+ int tgindx,
+ FmgrInfo *finfo,
+ Instrumentation *instr,
+ MemoryContext per_tuple_context);
static void AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
- int event, bool row_trigger,
- TupleTableSlot *oldtup, TupleTableSlot *newtup,
- List *recheckIndexes, Bitmapset *modifiedCols,
- TransitionCaptureState *transition_capture);
+ int event, bool row_trigger,
+ TupleTableSlot *oldtup, TupleTableSlot *newtup,
+ List *recheckIndexes, Bitmapset *modifiedCols,
+ TransitionCaptureState *transition_capture);
static void AfterTriggerEnlargeQueryState(void);
static bool before_stmt_triggers_fired(Oid relid, CmdType cmdType);
static AfterTriggersData afterTriggers;
static void AfterTriggerExecute(EState *estate,
- AfterTriggerEvent event,
- ResultRelInfo *relInfo,
- TriggerDesc *trigdesc,
- FmgrInfo *finfo,
- Instrumentation *instr,
- MemoryContext per_tuple_context,
- TupleTableSlot *trig_tuple_slot1,
- TupleTableSlot *trig_tuple_slot2);
+ AfterTriggerEvent event,
+ ResultRelInfo *relInfo,
+ TriggerDesc *trigdesc,
+ FmgrInfo *finfo,
+ Instrumentation *instr,
+ MemoryContext per_tuple_context,
+ TupleTableSlot *trig_tuple_slot1,
+ TupleTableSlot *trig_tuple_slot2);
static AfterTriggersTableData *GetAfterTriggersTableData(Oid relid,
- CmdType cmdType);
+ CmdType cmdType);
static void AfterTriggerFreeQuery(AfterTriggersQueryData *qs);
static SetConstraintState SetConstraintStateCreate(int numalloc);
static SetConstraintState SetConstraintStateCopy(SetConstraintState state);
static SetConstraintState SetConstraintStateAddItem(SetConstraintState state,
- Oid tgoid, bool tgisdeferred);
+ Oid tgoid, bool tgisdeferred);
static void cancel_prior_stmt_triggers(Oid relid, CmdType cmdType, int tgevent);
static void MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
- HeapTuple tup, Relation relMap);
+ HeapTuple tup, Relation relMap);
static void DropConfigurationMapping(AlterTSConfigurationStmt *stmt,
- HeapTuple tup, Relation relMap);
+ HeapTuple tup, Relation relMap);
/* --------------------- TS Parser commands ------------------------ */
Oid binary_upgrade_next_array_pg_type_oid = InvalidOid;
static void makeRangeConstructors(const char *name, Oid namespace,
- Oid rangeOid, Oid subtype);
+ Oid rangeOid, Oid subtype);
static Oid findTypeInputFunction(List *procname, Oid typeOid);
static Oid findTypeOutputFunction(List *procname, Oid typeOid);
static Oid findTypeReceiveFunction(List *procname, Oid typeOid);
static List *get_rels_with_domain(Oid domainOid, LOCKMODE lockmode);
static void checkEnumOwner(HeapTuple tup);
static char *domainAddConstraint(Oid domainOid, Oid domainNamespace,
- Oid baseTypeOid,
- int typMod, Constraint *constr,
- const char *domainName, ObjectAddress *constrAddr);
+ Oid baseTypeOid,
+ int typMod, Constraint *constr,
+ const char *domainName, ObjectAddress *constrAddr);
static Node *replace_domain_constraint_value(ParseState *pstate,
- ColumnRef *cref);
+ ColumnRef *cref);
/*
check_password_hook_type check_password_hook = NULL;
static void AddRoleMems(const char *rolename, Oid roleid,
- List *memberSpecs, List *memberIds,
- Oid grantorId, bool admin_opt);
+ List *memberSpecs, List *memberIds,
+ Oid grantorId, bool admin_opt);
static void DelRoleMems(const char *rolename, Oid roleid,
- List *memberSpecs, List *memberIds,
- bool admin_opt);
+ List *memberSpecs, List *memberIds,
+ bool admin_opt);
/* Check if current user has createrole privileges */
static List *expand_vacuum_rel(VacuumRelation *vrel, int options);
static List *get_all_vacuum_rels(int options);
static void vac_truncate_clog(TransactionId frozenXID,
- MultiXactId minMulti,
- TransactionId lastSaneFrozenXid,
- MultiXactId lastSaneMinMulti);
+ MultiXactId minMulti,
+ TransactionId lastSaneFrozenXid,
+ MultiXactId lastSaneMinMulti);
static bool vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params);
static VacOptTernaryValue get_vacopt_ternary_value(DefElem *def);
static char *fetch_cursor_param_value(ExprContext *econtext, int paramId);
static ScanState *search_plan_tree(PlanState *node, Oid table_oid,
- bool *pending_rescan);
+ bool *pending_rescan);
/*
static void ExecReadyExpr(ExprState *state);
static void ExecInitExprRec(Expr *node, ExprState *state,
- Datum *resv, bool *resnull);
+ Datum *resv, bool *resnull);
static void ExecInitFunc(ExprEvalStep *scratch, Expr *node, List *args,
- Oid funcid, Oid inputcollid,
- ExprState *state);
+ Oid funcid, Oid inputcollid,
+ ExprState *state);
static void ExecInitExprSlots(ExprState *state, Node *node);
static void ExecPushExprSlots(ExprState *state, LastAttnumInfo *info);
static bool get_last_attnums_walker(Node *node, LastAttnumInfo *info);
static void ExecComputeSlotInfo(ExprState *state, ExprEvalStep *op);
static void ExecInitWholeRowVar(ExprEvalStep *scratch, Var *variable,
- ExprState *state);
+ ExprState *state);
static void ExecInitSubscriptingRef(ExprEvalStep *scratch,
- SubscriptingRef *sbsref,
- ExprState *state,
- Datum *resv, bool *resnull);
+ SubscriptingRef *sbsref,
+ ExprState *state,
+ Datum *resv, bool *resnull);
static bool isAssignmentIndirectionExpr(Expr *expr);
static void ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
- ExprState *state,
- Datum *resv, bool *resnull);
+ ExprState *state,
+ Datum *resv, bool *resnull);
static void ExecBuildAggTransCall(ExprState *state, AggState *aggstate,
- ExprEvalStep *scratch,
- FunctionCallInfo fcinfo, AggStatePerTrans pertrans,
- int transno, int setno, int setoff, bool ishash);
+ ExprEvalStep *scratch,
+ FunctionCallInfo fcinfo, AggStatePerTrans pertrans,
+ int transno, int setno, int setoff, bool ishash);
/*
static void CheckVarSlotCompatibility(TupleTableSlot *slot, int attnum, Oid vartype);
static void CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot);
static TupleDesc get_cached_rowtype(Oid type_id, int32 typmod,
- TupleDesc *cache_field, ExprContext *econtext);
+ TupleDesc *cache_field, ExprContext *econtext);
static void ShutdownTupleDescRef(Datum arg);
static void ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op,
- ExprContext *econtext, bool checkisnull);
+ ExprContext *econtext, bool checkisnull);
/* fast-path evaluation functions */
static Datum ExecJustInnerVar(ExprState *state, ExprContext *econtext, bool *isnull);
} CEOUC_WAIT_MODE;
static bool check_exclusion_or_unique_constraint(Relation heap, Relation index,
- IndexInfo *indexInfo,
- ItemPointer tupleid,
- Datum *values, bool *isnull,
- EState *estate, bool newIndex,
- CEOUC_WAIT_MODE waitMode,
- bool errorOK,
- ItemPointer conflictTid);
+ IndexInfo *indexInfo,
+ ItemPointer tupleid,
+ Datum *values, bool *isnull,
+ EState *estate, bool newIndex,
+ CEOUC_WAIT_MODE waitMode,
+ bool errorOK,
+ ItemPointer conflictTid);
static bool index_recheck_constraint(Relation index, Oid *constr_procs,
- Datum *existing_values, bool *existing_isnull,
- Datum *new_values);
+ Datum *existing_values, bool *existing_isnull,
+ Datum *new_values);
/* ----------------------------------------------------------------
* ExecOpenIndices
static void ExecPostprocessPlan(EState *estate);
static void ExecEndPlan(PlanState *planstate, EState *estate);
static void ExecutePlan(EState *estate, PlanState *planstate,
- bool use_parallel_mode,
- CmdType operation,
- bool sendTuples,
- uint64 numberTuples,
- ScanDirection direction,
- DestReceiver *dest,
- bool execute_once);
+ bool use_parallel_mode,
+ CmdType operation,
+ bool sendTuples,
+ uint64 numberTuples,
+ ScanDirection direction,
+ DestReceiver *dest,
+ bool execute_once);
static bool ExecCheckRTEPerms(RangeTblEntry *rte);
static bool ExecCheckRTEPermsModified(Oid relOid, Oid userid,
- Bitmapset *modifiedCols,
- AclMode requiredPerms);
+ Bitmapset *modifiedCols,
+ AclMode requiredPerms);
static void ExecCheckXactReadOnly(PlannedStmt *plannedstmt);
static char *ExecBuildSlotValueDescription(Oid reloid,
- TupleTableSlot *slot,
- TupleDesc tupdesc,
- Bitmapset *modifiedCols,
- int maxfieldlen);
+ TupleTableSlot *slot,
+ TupleDesc tupdesc,
+ Bitmapset *modifiedCols,
+ int maxfieldlen);
static void EvalPlanQualStart(EPQState *epqstate, EState *parentestate,
- Plan *planTree);
+ Plan *planTree);
/*
* Note that GetAllUpdatedColumns() also exists in commands/trigger.c. There does
/* Helper functions that run in the parallel leader. */
static char *ExecSerializePlan(Plan *plan, EState *estate);
static bool ExecParallelEstimate(PlanState *node,
- ExecParallelEstimateContext *e);
+ ExecParallelEstimateContext *e);
static bool ExecParallelInitializeDSM(PlanState *node,
- ExecParallelInitializeDSMContext *d);
+ ExecParallelInitializeDSMContext *d);
static shm_mq_handle **ExecParallelSetupTupleQueues(ParallelContext *pcxt,
- bool reinitialize);
+ bool reinitialize);
static bool ExecParallelReInitializeDSM(PlanState *planstate,
- ParallelContext *pcxt);
+ ParallelContext *pcxt);
static bool ExecParallelRetrieveInstrumentation(PlanState *planstate,
- SharedExecutorInstrumentation *instrumentation);
+ SharedExecutorInstrumentation *instrumentation);
/* Helper function that runs in the parallel worker. */
static DestReceiver *ExecParallelGetReceiver(dsm_segment *seg, shm_toc *toc);
static void ExecHashSubPlanResultRelsByOid(ModifyTableState *mtstate,
- PartitionTupleRouting *proute);
+ PartitionTupleRouting *proute);
static ResultRelInfo *ExecInitPartitionInfo(ModifyTableState *mtstate,
- EState *estate, PartitionTupleRouting *proute,
- PartitionDispatch dispatch,
- ResultRelInfo *rootResultRelInfo,
- int partidx);
+ EState *estate, PartitionTupleRouting *proute,
+ PartitionDispatch dispatch,
+ ResultRelInfo *rootResultRelInfo,
+ int partidx);
static void ExecInitRoutingInfo(ModifyTableState *mtstate,
- EState *estate,
- PartitionTupleRouting *proute,
- PartitionDispatch dispatch,
- ResultRelInfo *partRelInfo,
- int partidx);
+ EState *estate,
+ PartitionTupleRouting *proute,
+ PartitionDispatch dispatch,
+ ResultRelInfo *partRelInfo,
+ int partidx);
static PartitionDispatch ExecInitPartitionDispatchInfo(EState *estate,
- PartitionTupleRouting *proute,
- Oid partoid, PartitionDispatch parent_pd, int partidx);
+ PartitionTupleRouting *proute,
+ Oid partoid, PartitionDispatch parent_pd, int partidx);
static void FormPartitionKeyDatum(PartitionDispatch pd,
- TupleTableSlot *slot,
- EState *estate,
- Datum *values,
- bool *isnull);
-static int get_partition_for_tuple(PartitionDispatch pd, Datum *values,
- bool *isnull);
+ TupleTableSlot *slot,
+ EState *estate,
+ Datum *values,
+ bool *isnull);
+static int get_partition_for_tuple(PartitionDispatch pd, Datum *values,
+ bool *isnull);
static char *ExecBuildSlotPartitionKeyDescription(Relation rel,
- Datum *values,
- bool *isnull,
- int maxfieldlen);
+ Datum *values,
+ bool *isnull,
+ int maxfieldlen);
static List *adjust_partition_tlist(List *tlist, TupleConversionMap *map);
static void ExecInitPruningContext(PartitionPruneContext *context,
- List *pruning_steps,
- PartitionDesc partdesc,
- PartitionKey partkey,
- PlanState *planstate);
+ List *pruning_steps,
+ PartitionDesc partdesc,
+ PartitionKey partkey,
+ PlanState *planstate);
static void find_matching_subplans_recurse(PartitionPruningData *prunedata,
- PartitionedRelPruningData *pprune,
- bool initial_prune,
- Bitmapset **validsubplans);
+ PartitionedRelPruningData *pprune,
+ bool initial_prune,
+ Bitmapset **validsubplans);
/*
/* static function decls */
static void init_sexpr(Oid foid, Oid input_collation, Expr *node,
- SetExprState *sexpr, PlanState *parent,
- MemoryContext sexprCxt, bool allowSRF, bool needDescForSRF);
+ SetExprState *sexpr, PlanState *parent,
+ MemoryContext sexprCxt, bool allowSRF, bool needDescForSRF);
static void ShutdownSetExpr(Datum arg);
static void ExecEvalFuncArgs(FunctionCallInfo fcinfo,
- List *argList, ExprContext *econtext);
+ List *argList, ExprContext *econtext);
static void ExecPrepareTuplestoreResult(SetExprState *sexpr,
- ExprContext *econtext,
- Tuplestorestate *resultStore,
- TupleDesc resultDesc);
+ ExprContext *econtext,
+ Tuplestorestate *resultStore,
+ TupleDesc resultDesc);
static void tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc);
static TupleDesc ExecTypeFromTLInternal(List *targetList,
- bool skipjunk);
+ bool skipjunk);
static pg_attribute_always_inline void slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp,
- int natts);
+ int natts);
static inline void tts_buffer_heap_store_tuple(TupleTableSlot *slot,
- HeapTuple tuple,
- Buffer buffer,
- bool transfer_pin);
+ HeapTuple tuple,
+ Buffer buffer,
+ bool transfer_pin);
static void tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree);
/* non-export function prototypes */
static Node *sql_fn_param_ref(ParseState *pstate, ParamRef *pref);
static Node *sql_fn_post_column_ref(ParseState *pstate,
- ColumnRef *cref, Node *var);
+ ColumnRef *cref, Node *var);
static Node *sql_fn_make_param(SQLFunctionParseInfoPtr pinfo,
- int paramno, int location);
+ int paramno, int location);
static Node *sql_fn_resolve_param_name(SQLFunctionParseInfoPtr pinfo,
- const char *paramname, int location);
+ const char *paramname, int location);
static List *init_execution_state(List *queryTree_list,
- SQLFunctionCachePtr fcache,
- bool lazyEvalOK);
+ SQLFunctionCachePtr fcache,
+ bool lazyEvalOK);
static void init_sql_fcache(FmgrInfo *finfo, Oid collation, bool lazyEvalOK);
static void postquel_start(execution_state *es, SQLFunctionCachePtr fcache);
static bool postquel_getnext(execution_state *es, SQLFunctionCachePtr fcache);
static void postquel_end(execution_state *es);
static void postquel_sub_params(SQLFunctionCachePtr fcache,
- FunctionCallInfo fcinfo);
+ FunctionCallInfo fcinfo);
static Datum postquel_get_single_result(TupleTableSlot *slot,
- FunctionCallInfo fcinfo,
- SQLFunctionCachePtr fcache,
- MemoryContext resultcontext);
+ FunctionCallInfo fcinfo,
+ SQLFunctionCachePtr fcache,
+ MemoryContext resultcontext);
static void sql_exec_error_callback(void *arg);
static void ShutdownSQLFunction(Datum arg);
static void sqlfunction_startup(DestReceiver *self, int operation, TupleDesc typeinfo);
static void BufferUsageAdd(BufferUsage *dst, const BufferUsage *add);
static void BufferUsageAccumDiff(BufferUsage *dst,
- const BufferUsage *add, const BufferUsage *sub);
+ const BufferUsage *add, const BufferUsage *sub);
/* Allocate new instrumentation structure(s) */
static void initialize_phase(AggState *aggstate, int newphase);
static TupleTableSlot *fetch_input_tuple(AggState *aggstate);
static void initialize_aggregates(AggState *aggstate,
- AggStatePerGroup *pergroups,
- int numReset);
+ AggStatePerGroup *pergroups,
+ int numReset);
static void advance_transition_function(AggState *aggstate,
- AggStatePerTrans pertrans,
- AggStatePerGroup pergroupstate);
+ AggStatePerTrans pertrans,
+ AggStatePerGroup pergroupstate);
static void advance_aggregates(AggState *aggstate);
static void process_ordered_aggregate_single(AggState *aggstate,
- AggStatePerTrans pertrans,
- AggStatePerGroup pergroupstate);
+ AggStatePerTrans pertrans,
+ AggStatePerGroup pergroupstate);
static void process_ordered_aggregate_multi(AggState *aggstate,
- AggStatePerTrans pertrans,
- AggStatePerGroup pergroupstate);
+ AggStatePerTrans pertrans,
+ AggStatePerGroup pergroupstate);
static void finalize_aggregate(AggState *aggstate,
- AggStatePerAgg peragg,
- AggStatePerGroup pergroupstate,
- Datum *resultVal, bool *resultIsNull);
+ AggStatePerAgg peragg,
+ AggStatePerGroup pergroupstate,
+ Datum *resultVal, bool *resultIsNull);
static void finalize_partialaggregate(AggState *aggstate,
- AggStatePerAgg peragg,
- AggStatePerGroup pergroupstate,
- Datum *resultVal, bool *resultIsNull);
+ AggStatePerAgg peragg,
+ AggStatePerGroup pergroupstate,
+ Datum *resultVal, bool *resultIsNull);
static void prepare_projection_slot(AggState *aggstate,
- TupleTableSlot *slot,
- int currentSet);
+ TupleTableSlot *slot,
+ int currentSet);
static void finalize_aggregates(AggState *aggstate,
- AggStatePerAgg peragg,
- AggStatePerGroup pergroup);
+ AggStatePerAgg peragg,
+ AggStatePerGroup pergroup);
static TupleTableSlot *project_aggregates(AggState *aggstate);
static Bitmapset *find_unaggregated_cols(AggState *aggstate);
static bool find_unaggregated_cols_walker(Node *node, Bitmapset **colnos);
static TupleTableSlot *agg_retrieve_hash_table(AggState *aggstate);
static Datum GetAggInitVal(Datum textInitVal, Oid transtype);
static void build_pertrans_for_aggref(AggStatePerTrans pertrans,
- AggState *aggstate, EState *estate,
- Aggref *aggref, Oid aggtransfn, Oid aggtranstype,
- Oid aggserialfn, Oid aggdeserialfn,
- Datum initValue, bool initValueIsNull,
- Oid *inputTypes, int numArguments);
-static int find_compatible_peragg(Aggref *newagg, AggState *aggstate,
- int lastaggno, List **same_input_transnos);
-static int find_compatible_pertrans(AggState *aggstate, Aggref *newagg,
- bool shareable,
- Oid aggtransfn, Oid aggtranstype,
- Oid aggserialfn, Oid aggdeserialfn,
- Datum initValue, bool initValueIsNull,
- List *transnos);
+ AggState *aggstate, EState *estate,
+ Aggref *aggref, Oid aggtransfn, Oid aggtranstype,
+ Oid aggserialfn, Oid aggdeserialfn,
+ Datum initValue, bool initValueIsNull,
+ Oid *inputTypes, int numArguments);
+static int find_compatible_peragg(Aggref *newagg, AggState *aggstate,
+ int lastaggno, List **same_input_transnos);
+static int find_compatible_pertrans(AggState *aggstate, Aggref *newagg,
+ bool shareable,
+ Oid aggtransfn, Oid aggtranstype,
+ Oid aggserialfn, Oid aggdeserialfn,
+ Datum initValue, bool initValueIsNull,
+ List *transnos);
/*
static TupleTableSlot *BitmapHeapNext(BitmapHeapScanState *node);
static inline void BitmapDoneInitializingSharedState(
- ParallelBitmapHeapState *pstate);
+ ParallelBitmapHeapState *pstate);
static inline void BitmapAdjustPrefetchIterator(BitmapHeapScanState *node,
- TBMIterateResult *tbmres);
+ TBMIterateResult *tbmres);
static inline void BitmapAdjustPrefetchTarget(BitmapHeapScanState *node);
static inline void BitmapPrefetch(BitmapHeapScanState *node,
- TableScanDesc scan);
+ TableScanDesc scan);
static bool BitmapShouldInitializeSharedState(
- ParallelBitmapHeapState *pstate);
+ ParallelBitmapHeapState *pstate);
/* ----------------------------------------------------------------
static int32 heap_compare_slots(Datum a, Datum b, void *arg);
static TupleTableSlot *gather_merge_getnext(GatherMergeState *gm_state);
static HeapTuple gm_readnext_tuple(GatherMergeState *gm_state, int nreader,
- bool nowait, bool *done);
+ bool nowait, bool *done);
static void ExecShutdownGatherMergeWorkers(GatherMergeState *node);
static void gather_merge_setup(GatherMergeState *gm_state);
static void gather_merge_init(GatherMergeState *gm_state);
static void gather_merge_clear_tuples(GatherMergeState *gm_state);
static bool gather_merge_readnext(GatherMergeState *gm_state, int reader,
- bool nowait);
+ bool nowait);
static void load_tuple_array(GatherMergeState *gm_state, int reader);
/* ----------------------------------------------------------------
static void ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable);
static void ExecParallelHashIncreaseNumBuckets(HashJoinTable hashtable);
static void ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node,
- int mcvsToUse);
+ int mcvsToUse);
static void ExecHashSkewTableInsert(HashJoinTable hashtable,
- TupleTableSlot *slot,
- uint32 hashvalue,
- int bucketNumber);
+ TupleTableSlot *slot,
+ uint32 hashvalue,
+ int bucketNumber);
static void ExecHashRemoveNextSkewBucket(HashJoinTable hashtable);
static void *dense_alloc(HashJoinTable hashtable, Size size);
static HashJoinTuple ExecParallelHashTupleAlloc(HashJoinTable hashtable,
- size_t size,
- dsa_pointer *shared);
+ size_t size,
+ dsa_pointer *shared);
static void MultiExecPrivateHash(HashState *node);
static void MultiExecParallelHash(HashState *node);
static inline HashJoinTuple ExecParallelHashFirstTuple(HashJoinTable table,
- int bucketno);
+ int bucketno);
static inline HashJoinTuple ExecParallelHashNextTuple(HashJoinTable table,
- HashJoinTuple tuple);
+ HashJoinTuple tuple);
static inline void ExecParallelHashPushTuple(dsa_pointer_atomic *head,
- HashJoinTuple tuple,
- dsa_pointer tuple_shared);
+ HashJoinTuple tuple,
+ dsa_pointer tuple_shared);
static void ExecParallelHashJoinSetUpBatches(HashJoinTable hashtable, int nbatch);
static void ExecParallelHashEnsureBatchAccessors(HashJoinTable hashtable);
static void ExecParallelHashRepartitionFirst(HashJoinTable hashtable);
static void ExecParallelHashRepartitionRest(HashJoinTable hashtable);
static HashMemoryChunk ExecParallelHashPopChunkQueue(HashJoinTable table,
- dsa_pointer *shared);
+ dsa_pointer *shared);
static bool ExecParallelHashTuplePrealloc(HashJoinTable hashtable,
- int batchno,
- size_t size);
+ int batchno,
+ size_t size);
static void ExecParallelHashMergeCounters(HashJoinTable hashtable);
static void ExecParallelHashCloseBatchAccessors(HashJoinTable hashtable);
#define HJ_FILL_INNER(hjstate) ((hjstate)->hj_NullOuterTupleSlot != NULL)
static TupleTableSlot *ExecHashJoinOuterGetTuple(PlanState *outerNode,
- HashJoinState *hjstate,
- uint32 *hashvalue);
+ HashJoinState *hjstate,
+ uint32 *hashvalue);
static TupleTableSlot *ExecParallelHashJoinOuterGetTuple(PlanState *outerNode,
- HashJoinState *hjstate,
- uint32 *hashvalue);
+ HashJoinState *hjstate,
+ uint32 *hashvalue);
static TupleTableSlot *ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
- BufFile *file,
- uint32 *hashvalue,
- TupleTableSlot *tupleSlot);
+ BufFile *file,
+ uint32 *hashvalue,
+ TupleTableSlot *tupleSlot);
static bool ExecHashJoinNewBatch(HashJoinState *hjstate);
static bool ExecParallelHashJoinNewBatch(HashJoinState *hjstate);
static void ExecParallelHashJoinPartitionOuter(HashJoinState *node);
static TupleTableSlot *IndexOnlyNext(IndexOnlyScanState *node);
static void StoreIndexTuple(TupleTableSlot *slot, IndexTuple itup,
- TupleDesc itupdesc);
+ TupleDesc itupdesc);
/* ----------------------------------------------------------------
static TupleTableSlot *IndexNextWithReorder(IndexScanState *node);
static void EvalOrderByExpressions(IndexScanState *node, ExprContext *econtext);
static bool IndexRecheck(IndexScanState *node, TupleTableSlot *slot);
-static int cmp_orderbyvals(const Datum *adist, const bool *anulls,
- const Datum *bdist, const bool *bnulls,
- IndexScanState *node);
-static int reorderqueue_cmp(const pairingheap_node *a,
- const pairingheap_node *b, void *arg);
+static int cmp_orderbyvals(const Datum *adist, const bool *anulls,
+ const Datum *bdist, const bool *bnulls,
+ IndexScanState *node);
+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);
+ Datum *orderbyvals, bool *orderbynulls);
static HeapTuple reorderqueue_pop(IndexScanState *node);
static bool ExecOnConflictUpdate(ModifyTableState *mtstate,
- ResultRelInfo *resultRelInfo,
- ItemPointer conflictTid,
- TupleTableSlot *planSlot,
- TupleTableSlot *excludedSlot,
- EState *estate,
- bool canSetTag,
- TupleTableSlot **returning);
+ ResultRelInfo *resultRelInfo,
+ ItemPointer conflictTid,
+ TupleTableSlot *planSlot,
+ TupleTableSlot *excludedSlot,
+ EState *estate,
+ bool canSetTag,
+ TupleTableSlot **returning);
static TupleTableSlot *ExecPrepareTupleRouting(ModifyTableState *mtstate,
- EState *estate,
- PartitionTupleRouting *proute,
- ResultRelInfo *targetRelInfo,
- TupleTableSlot *slot);
+ EState *estate,
+ PartitionTupleRouting *proute,
+ ResultRelInfo *targetRelInfo,
+ TupleTableSlot *slot);
static ResultRelInfo *getTargetResultRelInfo(ModifyTableState *node);
static void ExecSetupChildParentMapForSubplan(ModifyTableState *mtstate);
static TupleConversionMap *tupconv_map_for_subplan(ModifyTableState *node,
- int whichplan);
+ int whichplan);
/*
* Verify that the tuples to be produced by INSERT or UPDATE match the
static Datum ExecHashSubPlan(SubPlanState *node,
- ExprContext *econtext,
- bool *isNull);
+ ExprContext *econtext,
+ bool *isNull);
static Datum ExecScanSubPlan(SubPlanState *node,
- ExprContext *econtext,
- bool *isNull);
+ ExprContext *econtext,
+ bool *isNull);
static void buildSubPlanHash(SubPlanState *node, ExprContext *econtext);
static bool findPartialMatch(TupleHashTable hashtable, TupleTableSlot *slot,
- FmgrInfo *eqfunctions);
+ FmgrInfo *eqfunctions);
static bool slotAllNulls(TupleTableSlot *slot);
static bool slotNoNulls(TupleTableSlot *slot);
} WindowStatePerAggData;
static void initialize_windowaggregate(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate);
static void advance_windowaggregate(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate);
static bool advance_windowaggregate_base(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate);
static void finalize_windowaggregate(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate,
- Datum *result, bool *isnull);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate,
+ Datum *result, bool *isnull);
static void eval_windowaggregates(WindowAggState *winstate);
static void eval_windowfunction(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- Datum *result, bool *isnull);
+ WindowStatePerFunc perfuncstate,
+ Datum *result, bool *isnull);
static void begin_partition(WindowAggState *winstate);
static void spool_tuples(WindowAggState *winstate, int64 pos);
static void release_partition(WindowAggState *winstate);
-static int row_is_in_frame(WindowAggState *winstate, int64 pos,
- TupleTableSlot *slot);
+static int row_is_in_frame(WindowAggState *winstate, int64 pos,
+ TupleTableSlot *slot);
static void update_frameheadpos(WindowAggState *winstate);
static void update_frametailpos(WindowAggState *winstate);
static void update_grouptailpos(WindowAggState *winstate);
static WindowStatePerAggData *initialize_peragg(WindowAggState *winstate,
- WindowFunc *wfunc,
- WindowStatePerAgg peraggstate);
+ WindowFunc *wfunc,
+ WindowStatePerAgg peraggstate);
static Datum GetAggInitVal(Datum textInitVal, Oid transtype);
static bool are_peers(WindowAggState *winstate, TupleTableSlot *slot1,
- TupleTableSlot *slot2);
+ TupleTableSlot *slot2);
static bool window_gettupleslot(WindowObject winobj, int64 pos,
- TupleTableSlot *slot);
+ TupleTableSlot *slot);
/*
static int _SPI_connected = -1; /* current stack index */
static Portal SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
- ParamListInfo paramLI, bool read_only);
+ ParamListInfo paramLI, bool read_only);
static void _SPI_prepare_plan(const char *src, SPIPlanPtr plan);
static void _SPI_prepare_oneshot_plan(const char *src, SPIPlanPtr plan);
-static int _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
- Snapshot snapshot, Snapshot crosscheck_snapshot,
- bool read_only, bool fire_triggers, uint64 tcount);
+static int _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
+ Snapshot snapshot, Snapshot crosscheck_snapshot,
+ bool read_only, bool fire_triggers, uint64 tcount);
static ParamListInfo _SPI_convert_params(int nargs, Oid *argtypes,
- Datum *Values, const char *Nulls);
+ Datum *Values, const char *Nulls);
static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, uint64 tcount);
static void _SPI_error_callback(void *arg);
static void _SPI_cursor_operation(Portal portal,
- FetchDirection direction, long count,
- DestReceiver *dest);
+ FetchDirection direction, long count,
+ DestReceiver *dest);
static SPIPlanPtr _SPI_make_plan_non_temp(SPIPlanPtr plan);
static SPIPlanPtr _SPI_save_plan(SPIPlanPtr plan);
static Datum ExecRunCompiledExpr(ExprState *state, ExprContext *econtext, bool *isNull);
static LLVMValueRef BuildV1Call(LLVMJitContext *context, LLVMBuilderRef b,
- LLVMModuleRef mod, FunctionCallInfo fcinfo,
- LLVMValueRef *v_fcinfo_isnull);
+ LLVMModuleRef mod, FunctionCallInfo fcinfo,
+ LLVMValueRef *v_fcinfo_isnull);
static void build_EvalXFunc(LLVMBuilderRef b, LLVMModuleRef mod,
- const char *funcname,
- LLVMValueRef v_state, LLVMValueRef v_econtext,
- ExprEvalStep *op);
+ const char *funcname,
+ LLVMValueRef v_state, LLVMValueRef v_econtext,
+ ExprEvalStep *op);
static LLVMValueRef create_LifetimeEnd(LLVMModuleRef mod);
static int my_bloom_power(uint64 target_bitset_bits);
static int optimal_k(uint64 bitset_bits, int64 total_elems);
static void k_hashes(bloom_filter *filter, uint32 *hashes, unsigned char *elem,
- size_t len);
+ size_t len);
static inline uint32 mod_m(uint32 a, uint64 m);
/*
hash_table->size_log2)])
static void delete_item(dshash_table *hash_table,
- dshash_table_item *item);
+ dshash_table_item *item);
static void resize(dshash_table *hash_table, size_t new_size);
static inline void ensure_valid_bucket_pointers(dshash_table *hash_table);
static inline dshash_table_item *find_in_bucket(dshash_table *hash_table,
- const void *key,
- dsa_pointer item_pointer);
+ const void *key,
+ dsa_pointer item_pointer);
static void insert_item_into_bucket(dshash_table *hash_table,
- dsa_pointer item_pointer,
- dshash_table_item *item,
- dsa_pointer *bucket);
+ dsa_pointer item_pointer,
+ dshash_table_item *item,
+ dsa_pointer *bucket);
static dshash_table_item *insert_into_bucket(dshash_table *hash_table,
- const void *key,
- dsa_pointer *bucket);
+ const void *key,
+ dsa_pointer *bucket);
static bool delete_key_from_bucket(dshash_table *hash_table,
- const void *key,
- dsa_pointer *bucket_head);
+ const void *key,
+ dsa_pointer *bucket_head);
static bool delete_item_from_bucket(dshash_table *hash_table,
- dshash_table_item *item,
- dsa_pointer *bucket_head);
+ dshash_table_item *item,
+ dsa_pointer *bucket_head);
static inline dshash_hash hash_key(dshash_table *hash_table, const void *key);
static inline bool equal_keys(dshash_table *hash_table,
- const void *a, const void *b);
+ const void *a, const void *b);
#define PARTITION_LOCK(hash_table, i) \
(&(hash_table)->control->partitions[(i)].lock)
* Prototypes for internal functions.
*/
static void intset_update_upper(IntegerSet *intset, int level,
- intset_node *new_node, uint64 new_node_item);
+ intset_node *new_node, uint64 new_node_item);
static void intset_flush_buffered_values(IntegerSet *intset);
-static int intset_binsrch_uint64(uint64 value, uint64 *arr, int arr_elems,
- bool nextkey);
-static int intset_binsrch_leaf(uint64 value, leaf_item *arr, int arr_elems,
- bool nextkey);
+static int intset_binsrch_uint64(uint64 value, uint64 *arr, int arr_elems,
+ bool nextkey);
+static int intset_binsrch_leaf(uint64 value, leaf_item *arr, int arr_elems,
+ bool nextkey);
static uint64 simple8b_encode(const uint64 *ints, int *num_encoded, uint64 base);
static int simple8b_decode(uint64 codeword, uint64 *decoded, uint64 base);
#include "lib/pairingheap.h"
static pairingheap_node *merge(pairingheap *heap, pairingheap_node *a,
- pairingheap_node *b);
+ pairingheap_node *b);
static pairingheap_node *merge_children(pairingheap *heap,
- pairingheap_node *children);
+ pairingheap_node *children);
/*
* pairingheap_allocate
static bool verify_client_proof(scram_state *state);
static bool verify_final_nonce(scram_state *state);
static void mock_scram_verifier(const char *username, int *iterations,
- char **salt, uint8 *stored_key, uint8 *server_key);
+ char **salt, uint8 *stored_key, uint8 *server_key);
static bool is_scram_printable(char *p);
static char *sanitize_char(char c);
static char *sanitize_str(const char *s);
*----------------------------------------------------------------
*/
static void sendAuthRequest(Port *port, AuthRequest areq, const char *extradata,
- int extralen);
+ int extralen);
static void auth_failed(Port *port, int status, char *logdetail);
static char *recv_password_packet(Port *port);
#define PGSQL_PAM_SERVICE "postgresql" /* Service name passed to PAM */
static int CheckPAMAuth(Port *port, const char *user, const char *password);
-static int pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
- struct pam_response **resp, void *appdata_ptr);
+static int pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
+ struct pam_response **resp, void *appdata_ptr);
static struct pam_conv pam_passw_conv = {
&pam_passwd_conv_proc,
(WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) (
PCtxtHandle, void **);
static int pg_SSPI_recvauth(Port *port);
-static int pg_SSPI_make_upn(char *accountname,
- size_t accountnamesize,
- char *domainname,
- size_t domainnamesize,
- bool update_accountname);
+static int pg_SSPI_make_upn(char *accountname,
+ size_t accountnamesize,
+ char *domainname,
+ size_t domainnamesize,
+ bool update_accountname);
#endif
/*----------------------------------------------------------------
#include <gssapi/gssapi.h>
#endif
-void pg_GSS_error(int severity, const char *errmsg,
- OM_uint32 maj_stat, OM_uint32 min_stat);
+void pg_GSS_error(int severity, const char *errmsg,
+ OM_uint32 maj_stat, OM_uint32 min_stat);
#endif /* BE_GSSAPI_COMMON_H */
static bool dummy_ssl_passwd_cb_called = false;
static bool ssl_is_server_start;
-static int ssl_protocol_version_to_openssl(int v, const char *guc_name,
- int loglevel);
+static int ssl_protocol_version_to_openssl(int v, const char *guc_name,
+ int loglevel);
#ifndef SSL_CTX_set_min_proto_version
static int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);
static int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version);
static MemoryContext tokenize_file(const char *filename, FILE *file,
- List **tok_lines, int elevel);
+ List **tok_lines, int elevel);
static List *tokenize_inc_file(List *tokens, const char *outer_filename,
- const char *inc_filename, int elevel, char **err_msg);
+ const char *inc_filename, int elevel, char **err_msg);
static bool parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline,
- int elevel, char **err_msg);
+ int elevel, char **err_msg);
static bool verify_option_list_length(List *options, const char *optionname,
- List *masters, const char *mastername, int line_num);
+ List *masters, const char *mastername, int line_num);
static ArrayType *gethba_options(HbaLine *hba);
static void fill_hba_line(Tuplestorestate *tuple_store, TupleDesc tupdesc,
- int lineno, HbaLine *hba, const char *err_msg);
+ int lineno, HbaLine *hba, const char *err_msg);
static void fill_hba_view(Tuplestorestate *tuple_store, TupleDesc tupdesc);
#include "libpq/ifaddr.h"
#include "port/pg_bswap.h"
-static int range_sockaddr_AF_INET(const struct sockaddr_in *addr,
- const struct sockaddr_in *netaddr,
- const struct sockaddr_in *netmask);
+static int range_sockaddr_AF_INET(const struct sockaddr_in *addr,
+ const struct sockaddr_in *netaddr,
+ const struct sockaddr_in *netmask);
#ifdef HAVE_IPV6
-static int range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
- const struct sockaddr_in6 *netaddr,
- const struct sockaddr_in6 *netmask);
+static int range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
+ const struct sockaddr_in6 *netaddr,
+ const struct sockaddr_in6 *netmask);
#endif
static bool planstate_walk_subplans(List *plans, bool (*walker) (),
void *context);
static bool planstate_walk_members(PlanState **planstates, int nplans,
- bool (*walker) (), void *context);
+ bool (*walker) (), void *context);
/*
/* Local function prototypes */
static void tbm_union_page(TIDBitmap *a, const PagetableEntry *bpage);
static bool tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage,
- const TIDBitmap *b);
+ const TIDBitmap *b);
static const PagetableEntry *tbm_find_pageentry(const TIDBitmap *tbm,
- BlockNumber pageno);
+ BlockNumber pageno);
static PagetableEntry *tbm_get_pageentry(TIDBitmap *tbm, BlockNumber pageno);
static bool tbm_page_is_lossy(const TIDBitmap *tbm, BlockNumber pageno);
static void tbm_mark_page_lossy(TIDBitmap *tbm, BlockNumber pageno);
static void tbm_lossify(TIDBitmap *tbm);
static int tbm_comparator(const void *left, const void *right);
-static int tbm_shared_comparator(const void *left, const void *right,
- void *arg);
+static int tbm_shared_comparator(const void *left, const void *right,
+ void *arg);
/* define hashtable mapping block numbers to PagetableEntry's */
#define SH_USE_NONDEFAULT_ALLOCATOR
} Clump;
static List *merge_clump(PlannerInfo *root, List *clumps, Clump *new_clump,
- int num_gene, bool force);
+ int num_gene, bool force);
static bool desirable_join(PlannerInfo *root,
- RelOptInfo *outer_rel, RelOptInfo *inner_rel);
+ RelOptInfo *outer_rel, RelOptInfo *inner_rel);
/*
static void set_base_rel_sizes(PlannerInfo *root);
static void set_base_rel_pathlists(PlannerInfo *root);
static void set_rel_size(PlannerInfo *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static void set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static void set_plain_rel_size(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel);
static void set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_tablesample_rel_size(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_tablesample_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_foreign_size(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_foreign_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static void generate_orderedappend_paths(PlannerInfo *root, RelOptInfo *rel,
- List *live_childrels,
- List *all_child_pathkeys,
- List *partitioned_rels);
+ List *live_childrels,
+ List *all_child_pathkeys,
+ List *partitioned_rels);
static Path *get_cheapest_parameterized_child_path(PlannerInfo *root,
- RelOptInfo *rel,
- Relids required_outer);
+ RelOptInfo *rel,
+ Relids required_outer);
static void accumulate_append_subpath(Path *path,
- List **subpaths, List **special_subpaths);
+ List **subpaths, List **special_subpaths);
static Path *get_singleton_append_subpath(Path *path);
static void set_dummy_rel_pathlist(RelOptInfo *rel);
static void set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static void set_function_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_values_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_tablefunc_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_cte_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
-static void set_namedtuplestore_pathlist(PlannerInfo *root, RelOptInfo *rel,
RangeTblEntry *rte);
+static void set_namedtuplestore_pathlist(PlannerInfo *root, RelOptInfo *rel,
+ RangeTblEntry *rte);
static void set_result_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_worktable_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static RelOptInfo *make_rel_from_joinlist(PlannerInfo *root, List *joinlist);
static bool subquery_is_pushdown_safe(Query *subquery, Query *topquery,
- pushdown_safety_info *safetyInfo);
+ pushdown_safety_info *safetyInfo);
static bool recurse_pushdown_safe(Node *setOp, Query *topquery,
- pushdown_safety_info *safetyInfo);
+ pushdown_safety_info *safetyInfo);
static void check_output_expressions(Query *subquery,
- pushdown_safety_info *safetyInfo);
+ pushdown_safety_info *safetyInfo);
static void compare_tlist_datatypes(List *tlist, List *colTypes,
- pushdown_safety_info *safetyInfo);
+ pushdown_safety_info *safetyInfo);
static bool targetIsInAllPartitionLists(TargetEntry *tle, Query *query);
static bool qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual,
- pushdown_safety_info *safetyInfo);
+ pushdown_safety_info *safetyInfo);
static void subquery_push_qual(Query *subquery,
- RangeTblEntry *rte, Index rti, Node *qual);
+ RangeTblEntry *rte, Index rti, Node *qual);
static void recurse_push_qual(Node *setOp, Query *topquery,
- RangeTblEntry *rte, Index rti, Node *qual);
+ RangeTblEntry *rte, Index rti, Node *qual);
static void remove_unused_subquery_outputs(Query *subquery, RelOptInfo *rel);
} RangeQueryClause;
static void addRangeClause(RangeQueryClause **rqlist, Node *clause,
- bool varonleft, bool isLTsel, Selectivity s2);
+ bool varonleft, bool isLTsel, Selectivity s2);
static RelOptInfo *find_single_rel_for_clauses(PlannerInfo *root,
- List *clauses);
+ List *clauses);
/****************************************************************************
* ROUTINES TO COMPUTE SELECTIVITIES
static List *extract_nonindex_conditions(List *qual_clauses, List *indexclauses);
static MergeScanSelCache *cached_scansel(PlannerInfo *root,
- RestrictInfo *rinfo,
- PathKey *pathkey);
+ RestrictInfo *rinfo,
+ PathKey *pathkey);
static void cost_rescan(PlannerInfo *root, Path *path,
- Cost *rescan_startup_cost, Cost *rescan_total_cost);
+ Cost *rescan_startup_cost, Cost *rescan_total_cost);
static bool cost_qual_eval_walker(Node *node, cost_qual_eval_context *context);
static void get_restriction_qual_cost(PlannerInfo *root, RelOptInfo *baserel,
- ParamPathInfo *param_info,
- QualCost *qpqual_cost);
+ ParamPathInfo *param_info,
+ QualCost *qpqual_cost);
static bool has_indexed_join_quals(NestPath *joinpath);
static double approx_tuple_count(PlannerInfo *root, JoinPath *path,
- List *quals);
+ List *quals);
static double calc_joinrel_size_estimate(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *outer_rel,
- RelOptInfo *inner_rel,
- double outer_rows,
- double inner_rows,
- SpecialJoinInfo *sjinfo,
- List *restrictlist);
+ RelOptInfo *joinrel,
+ RelOptInfo *outer_rel,
+ RelOptInfo *inner_rel,
+ double outer_rows,
+ double inner_rows,
+ SpecialJoinInfo *sjinfo,
+ List *restrictlist);
static Selectivity get_foreign_key_join_selectivity(PlannerInfo *root,
- Relids outer_relids,
- Relids inner_relids,
- SpecialJoinInfo *sjinfo,
- List **restrictlist);
+ Relids outer_relids,
+ Relids inner_relids,
+ SpecialJoinInfo *sjinfo,
+ List **restrictlist);
static Cost append_nonpartial_cost(List *subpaths, int numpaths,
- int parallel_workers);
+ int parallel_workers);
static void set_rel_width(PlannerInfo *root, RelOptInfo *rel);
static double relation_byte_size(double tuples, int width);
static double page_size(double tuples, int width);
static EquivalenceMember *add_eq_member(EquivalenceClass *ec,
- Expr *expr, Relids relids, Relids nullable_relids,
- bool is_child, Oid datatype);
+ Expr *expr, Relids relids, Relids nullable_relids,
+ bool is_child, Oid datatype);
static void generate_base_implied_equalities_const(PlannerInfo *root,
- EquivalenceClass *ec);
+ EquivalenceClass *ec);
static void generate_base_implied_equalities_no_const(PlannerInfo *root,
- EquivalenceClass *ec);
+ EquivalenceClass *ec);
static void generate_base_implied_equalities_broken(PlannerInfo *root,
- EquivalenceClass *ec);
+ EquivalenceClass *ec);
static List *generate_join_implied_equalities_normal(PlannerInfo *root,
- EquivalenceClass *ec,
- Relids join_relids,
- Relids outer_relids,
- Relids inner_relids);
+ EquivalenceClass *ec,
+ Relids join_relids,
+ Relids outer_relids,
+ Relids inner_relids);
static List *generate_join_implied_equalities_broken(PlannerInfo *root,
- EquivalenceClass *ec,
- Relids nominal_join_relids,
- Relids outer_relids,
- Relids nominal_inner_relids,
- RelOptInfo *inner_rel);
-static Oid select_equality_operator(EquivalenceClass *ec,
- Oid lefttype, Oid righttype);
+ EquivalenceClass *ec,
+ Relids nominal_join_relids,
+ Relids outer_relids,
+ Relids nominal_inner_relids,
+ RelOptInfo *inner_rel);
+static Oid select_equality_operator(EquivalenceClass *ec,
+ Oid lefttype, Oid righttype);
static RestrictInfo *create_join_clause(PlannerInfo *root,
- EquivalenceClass *ec, Oid opno,
- EquivalenceMember *leftem,
- EquivalenceMember *rightem,
- EquivalenceClass *parent_ec);
+ EquivalenceClass *ec, Oid opno,
+ EquivalenceMember *leftem,
+ EquivalenceMember *rightem,
+ EquivalenceClass *parent_ec);
static bool reconsider_outer_join_clause(PlannerInfo *root,
- RestrictInfo *rinfo,
- bool outer_on_left);
+ RestrictInfo *rinfo,
+ bool outer_on_left);
static bool reconsider_full_join_clause(PlannerInfo *root,
- RestrictInfo *rinfo);
+ RestrictInfo *rinfo);
/*
static void consider_index_join_clauses(PlannerInfo *root, RelOptInfo *rel,
- IndexOptInfo *index,
- IndexClauseSet *rclauseset,
- IndexClauseSet *jclauseset,
- IndexClauseSet *eclauseset,
- List **bitindexpaths);
+ IndexOptInfo *index,
+ IndexClauseSet *rclauseset,
+ IndexClauseSet *jclauseset,
+ IndexClauseSet *eclauseset,
+ List **bitindexpaths);
static void consider_index_join_outer_rels(PlannerInfo *root, RelOptInfo *rel,
- IndexOptInfo *index,
- IndexClauseSet *rclauseset,
- IndexClauseSet *jclauseset,
- IndexClauseSet *eclauseset,
- List **bitindexpaths,
- List *indexjoinclauses,
- int considered_clauses,
- List **considered_relids);
+ IndexOptInfo *index,
+ IndexClauseSet *rclauseset,
+ IndexClauseSet *jclauseset,
+ IndexClauseSet *eclauseset,
+ List **bitindexpaths,
+ List *indexjoinclauses,
+ int considered_clauses,
+ List **considered_relids);
static void get_join_index_paths(PlannerInfo *root, RelOptInfo *rel,
- IndexOptInfo *index,
- IndexClauseSet *rclauseset,
- IndexClauseSet *jclauseset,
- IndexClauseSet *eclauseset,
- List **bitindexpaths,
- Relids relids,
- List **considered_relids);
+ IndexOptInfo *index,
+ IndexClauseSet *rclauseset,
+ IndexClauseSet *jclauseset,
+ IndexClauseSet *eclauseset,
+ List **bitindexpaths,
+ Relids relids,
+ List **considered_relids);
static bool eclass_already_used(EquivalenceClass *parent_ec, Relids oldrelids,
- List *indexjoinclauses);
+ List *indexjoinclauses);
static bool bms_equal_any(Relids relids, List *relids_list);
static void get_index_paths(PlannerInfo *root, RelOptInfo *rel,
- IndexOptInfo *index, IndexClauseSet *clauses,
- List **bitindexpaths);
+ IndexOptInfo *index, IndexClauseSet *clauses,
+ List **bitindexpaths);
static List *build_index_paths(PlannerInfo *root, RelOptInfo *rel,
- IndexOptInfo *index, IndexClauseSet *clauses,
- bool useful_predicate,
- ScanTypeControl scantype,
- bool *skip_nonnative_saop,
- bool *skip_lower_saop);
+ IndexOptInfo *index, IndexClauseSet *clauses,
+ bool useful_predicate,
+ ScanTypeControl scantype,
+ bool *skip_nonnative_saop,
+ bool *skip_lower_saop);
static List *build_paths_for_OR(PlannerInfo *root, RelOptInfo *rel,
- List *clauses, List *other_clauses);
+ List *clauses, List *other_clauses);
static List *generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
- List *clauses, List *other_clauses);
+ List *clauses, List *other_clauses);
static Path *choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
- List *paths);
+ List *paths);
static int path_usage_comparator(const void *a, const void *b);
static Cost bitmap_scan_cost_est(PlannerInfo *root, RelOptInfo *rel,
- Path *ipath);
+ Path *ipath);
static Cost bitmap_and_cost_est(PlannerInfo *root, RelOptInfo *rel,
- List *paths);
+ List *paths);
static PathClauseUsage *classify_index_clause_usage(Path *path,
- List **clauselist);
+ List **clauselist);
static Relids get_bitmap_tree_required_outer(Path *bitmapqual);
static void find_indexpath_quals(Path *bitmapqual, List **quals, List **preds);
static int find_list_position(Node *node, List **nodelist);
static bool check_index_only(RelOptInfo *rel, IndexOptInfo *index);
static double get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids);
static double adjust_rowcount_for_semijoins(PlannerInfo *root,
- Index cur_relid,
- Index outer_relid,
- double rowcount);
+ Index cur_relid,
+ Index outer_relid,
+ double rowcount);
static double approximate_joinrel_size(PlannerInfo *root, Relids relids);
static void match_restriction_clauses_to_index(PlannerInfo *root,
- IndexOptInfo *index,
- IndexClauseSet *clauseset);
+ IndexOptInfo *index,
+ IndexClauseSet *clauseset);
static void match_join_clauses_to_index(PlannerInfo *root,
- RelOptInfo *rel, IndexOptInfo *index,
- IndexClauseSet *clauseset,
- List **joinorclauses);
+ RelOptInfo *rel, IndexOptInfo *index,
+ IndexClauseSet *clauseset,
+ List **joinorclauses);
static void match_eclass_clauses_to_index(PlannerInfo *root,
- IndexOptInfo *index,
- IndexClauseSet *clauseset);
+ IndexOptInfo *index,
+ IndexClauseSet *clauseset);
static void match_clauses_to_index(PlannerInfo *root,
- List *clauses,
- IndexOptInfo *index,
- IndexClauseSet *clauseset);
+ List *clauses,
+ IndexOptInfo *index,
+ IndexClauseSet *clauseset);
static void match_clause_to_index(PlannerInfo *root,
- RestrictInfo *rinfo,
- IndexOptInfo *index,
- IndexClauseSet *clauseset);
+ RestrictInfo *rinfo,
+ IndexOptInfo *index,
+ IndexClauseSet *clauseset);
static IndexClause *match_clause_to_indexcol(PlannerInfo *root,
- RestrictInfo *rinfo,
- int indexcol,
- IndexOptInfo *index);
+ RestrictInfo *rinfo,
+ int indexcol,
+ IndexOptInfo *index);
static IndexClause *match_boolean_index_clause(RestrictInfo *rinfo,
- int indexcol, IndexOptInfo *index);
+ int indexcol, IndexOptInfo *index);
static IndexClause *match_opclause_to_indexcol(PlannerInfo *root,
- RestrictInfo *rinfo,
- int indexcol,
- IndexOptInfo *index);
+ RestrictInfo *rinfo,
+ int indexcol,
+ IndexOptInfo *index);
static IndexClause *match_funcclause_to_indexcol(PlannerInfo *root,
- RestrictInfo *rinfo,
- int indexcol,
- IndexOptInfo *index);
+ RestrictInfo *rinfo,
+ int indexcol,
+ IndexOptInfo *index);
static IndexClause *get_index_clause_from_support(PlannerInfo *root,
- RestrictInfo *rinfo,
- Oid funcid,
- int indexarg,
- int indexcol,
- IndexOptInfo *index);
+ RestrictInfo *rinfo,
+ Oid funcid,
+ int indexarg,
+ int indexcol,
+ IndexOptInfo *index);
static IndexClause *match_saopclause_to_indexcol(RestrictInfo *rinfo,
- int indexcol,
- IndexOptInfo *index);
+ int indexcol,
+ IndexOptInfo *index);
static IndexClause *match_rowcompare_to_indexcol(RestrictInfo *rinfo,
- int indexcol,
- IndexOptInfo *index);
+ int indexcol,
+ IndexOptInfo *index);
static IndexClause *expand_indexqual_rowcompare(RestrictInfo *rinfo,
- int indexcol,
- IndexOptInfo *index,
- Oid expr_op,
- bool var_on_left);
+ int indexcol,
+ IndexOptInfo *index,
+ Oid expr_op,
+ bool var_on_left);
static void match_pathkeys_to_index(IndexOptInfo *index, List *pathkeys,
- List **orderby_clauses_p,
- List **clause_columns_p);
+ List **orderby_clauses_p,
+ List **clause_columns_p);
static Expr *match_clause_to_ordering_op(IndexOptInfo *index,
- int indexcol, Expr *clause, Oid pk_opfamily);
+ int indexcol, Expr *clause, Oid pk_opfamily);
static bool ec_member_matches_indexcol(PlannerInfo *root, RelOptInfo *rel,
- EquivalenceClass *ec, EquivalenceMember *em,
- void *arg);
+ EquivalenceClass *ec, EquivalenceMember *em,
+ void *arg);
/*
(PATH_PARAM_BY_REL_SELF(path, rel) || PATH_PARAM_BY_PARENT(path, rel))
static void try_partial_mergejoin_path(PlannerInfo *root,
- RelOptInfo *joinrel,
- Path *outer_path,
- Path *inner_path,
- List *pathkeys,
- List *mergeclauses,
- List *outersortkeys,
- List *innersortkeys,
- JoinType jointype,
- JoinPathExtraData *extra);
+ RelOptInfo *joinrel,
+ Path *outer_path,
+ Path *inner_path,
+ List *pathkeys,
+ List *mergeclauses,
+ List *outersortkeys,
+ List *innersortkeys,
+ JoinType jointype,
+ JoinPathExtraData *extra);
static void sort_inner_and_outer(PlannerInfo *root, RelOptInfo *joinrel,
- RelOptInfo *outerrel, RelOptInfo *innerrel,
- JoinType jointype, JoinPathExtraData *extra);
+ RelOptInfo *outerrel, RelOptInfo *innerrel,
+ JoinType jointype, JoinPathExtraData *extra);
static void match_unsorted_outer(PlannerInfo *root, RelOptInfo *joinrel,
- RelOptInfo *outerrel, RelOptInfo *innerrel,
- JoinType jointype, JoinPathExtraData *extra);
+ RelOptInfo *outerrel, RelOptInfo *innerrel,
+ JoinType jointype, JoinPathExtraData *extra);
static void consider_parallel_nestloop(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *outerrel,
- RelOptInfo *innerrel,
- JoinType jointype,
- JoinPathExtraData *extra);
+ RelOptInfo *joinrel,
+ RelOptInfo *outerrel,
+ RelOptInfo *innerrel,
+ JoinType jointype,
+ JoinPathExtraData *extra);
static void consider_parallel_mergejoin(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *outerrel,
- RelOptInfo *innerrel,
- JoinType jointype,
- JoinPathExtraData *extra,
- Path *inner_cheapest_total);
+ RelOptInfo *joinrel,
+ RelOptInfo *outerrel,
+ RelOptInfo *innerrel,
+ JoinType jointype,
+ JoinPathExtraData *extra,
+ Path *inner_cheapest_total);
static void hash_inner_and_outer(PlannerInfo *root, RelOptInfo *joinrel,
- RelOptInfo *outerrel, RelOptInfo *innerrel,
- JoinType jointype, JoinPathExtraData *extra);
+ RelOptInfo *outerrel, RelOptInfo *innerrel,
+ JoinType jointype, JoinPathExtraData *extra);
static List *select_mergejoin_clauses(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *outerrel,
- RelOptInfo *innerrel,
- List *restrictlist,
- JoinType jointype,
- bool *mergejoin_allowed);
+ RelOptInfo *joinrel,
+ RelOptInfo *outerrel,
+ RelOptInfo *innerrel,
+ List *restrictlist,
+ JoinType jointype,
+ bool *mergejoin_allowed);
static void generate_mergejoin_paths(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *innerrel,
- Path *outerpath,
- JoinType jointype,
- JoinPathExtraData *extra,
- bool useallclauses,
- Path *inner_cheapest_total,
- List *merge_pathkeys,
- bool is_partial);
+ RelOptInfo *joinrel,
+ RelOptInfo *innerrel,
+ Path *outerpath,
+ JoinType jointype,
+ JoinPathExtraData *extra,
+ bool useallclauses,
+ Path *inner_cheapest_total,
+ List *merge_pathkeys,
+ bool is_partial);
/*
static void make_rels_by_clause_joins(PlannerInfo *root,
- RelOptInfo *old_rel,
- ListCell *other_rels);
+ RelOptInfo *old_rel,
+ ListCell *other_rels);
static void make_rels_by_clauseless_joins(PlannerInfo *root,
- RelOptInfo *old_rel,
- ListCell *other_rels);
+ RelOptInfo *old_rel,
+ ListCell *other_rels);
static bool has_join_restriction(PlannerInfo *root, RelOptInfo *rel);
static bool has_legal_joinclause(PlannerInfo *root, RelOptInfo *rel);
static bool restriction_is_constant_false(List *restrictlist,
- RelOptInfo *joinrel,
- bool only_pushed_down);
+ RelOptInfo *joinrel,
+ bool only_pushed_down);
static void populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
- RelOptInfo *rel2, RelOptInfo *joinrel,
- SpecialJoinInfo *sjinfo, List *restrictlist);
+ RelOptInfo *rel2, RelOptInfo *joinrel,
+ SpecialJoinInfo *sjinfo, List *restrictlist);
static void try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1,
- RelOptInfo *rel2, RelOptInfo *joinrel,
- SpecialJoinInfo *parent_sjinfo,
- List *parent_restrictlist);
+ RelOptInfo *rel2, RelOptInfo *joinrel,
+ SpecialJoinInfo *parent_sjinfo,
+ List *parent_restrictlist);
static SpecialJoinInfo *build_child_join_sjinfo(PlannerInfo *root,
- SpecialJoinInfo *parent_sjinfo,
- Relids left_relids, Relids right_relids);
-static int match_expr_to_partition_keys(Expr *expr, RelOptInfo *rel,
- bool strict_op);
+ SpecialJoinInfo *parent_sjinfo,
+ Relids left_relids, Relids right_relids);
+static int match_expr_to_partition_keys(Expr *expr, RelOptInfo *rel,
+ bool strict_op);
/*
static bool pathkey_is_redundant(PathKey *new_pathkey, List *pathkeys);
static bool matches_boolean_partition_clause(RestrictInfo *rinfo,
- RelOptInfo *partrel,
- int partkeycol);
+ RelOptInfo *partrel,
+ int partkeycol);
static Var *find_var_for_subquery_tle(RelOptInfo *rel, TargetEntry *tle);
static bool right_merge_direction(PlannerInfo *root, PathKey *pathkey);
/* local functions */
static bool join_is_removable(PlannerInfo *root, SpecialJoinInfo *sjinfo);
static void remove_rel_from_query(PlannerInfo *root, int relid,
- Relids joinrelids);
+ Relids joinrelids);
static List *remove_rel_from_joinlist(List *joinlist, int relid, int *nremoved);
static bool rel_supports_distinctness(PlannerInfo *root, RelOptInfo *rel);
static bool rel_is_distinct_for(PlannerInfo *root, RelOptInfo *rel,
- List *clause_list);
+ List *clause_list);
static Oid distinct_col_search(int colno, List *colnos, List *opids);
static bool is_innerrel_unique_for(PlannerInfo *root,
- Relids joinrelids,
- Relids outerrelids,
- RelOptInfo *innerrel,
- JoinType jointype,
- List *restrictlist);
+ Relids joinrelids,
+ Relids outerrelids,
+ RelOptInfo *innerrel,
+ JoinType jointype,
+ List *restrictlist);
/*
static Plan *create_plan_recurse(PlannerInfo *root, Path *best_path,
- int flags);
+ int flags);
static Plan *create_scan_plan(PlannerInfo *root, Path *best_path,
- int flags);
+ int flags);
static List *build_path_tlist(PlannerInfo *root, Path *path);
static bool use_physical_tlist(PlannerInfo *root, Path *path, int flags);
static List *get_gating_quals(PlannerInfo *root, List *quals);
static Plan *create_gating_plan(PlannerInfo *root, Path *path, Plan *plan,
- List *gating_quals);
+ List *gating_quals);
static Plan *create_join_plan(PlannerInfo *root, JoinPath *best_path);
static Plan *create_append_plan(PlannerInfo *root, AppendPath *best_path,
- int flags);
+ int flags);
static Plan *create_merge_append_plan(PlannerInfo *root, MergeAppendPath *best_path,
- int flags);
+ int flags);
static Result *create_group_result_plan(PlannerInfo *root,
- GroupResultPath *best_path);
+ GroupResultPath *best_path);
static ProjectSet *create_project_set_plan(PlannerInfo *root, ProjectSetPath *best_path);
static Material *create_material_plan(PlannerInfo *root, MaterialPath *best_path,
- int flags);
+ int flags);
static Plan *create_unique_plan(PlannerInfo *root, UniquePath *best_path,
- int flags);
+ int flags);
static Gather *create_gather_plan(PlannerInfo *root, GatherPath *best_path);
static Plan *create_projection_plan(PlannerInfo *root,
- ProjectionPath *best_path,
- int flags);
+ ProjectionPath *best_path,
+ int flags);
static Plan *inject_projection_plan(Plan *subplan, List *tlist, bool parallel_safe);
static Sort *create_sort_plan(PlannerInfo *root, SortPath *best_path, int flags);
static Group *create_group_plan(PlannerInfo *root, GroupPath *best_path);
static Unique *create_upper_unique_plan(PlannerInfo *root, UpperUniquePath *best_path,
- int flags);
+ int flags);
static Agg *create_agg_plan(PlannerInfo *root, AggPath *best_path);
static Plan *create_groupingsets_plan(PlannerInfo *root, GroupingSetsPath *best_path);
static Result *create_minmaxagg_plan(PlannerInfo *root, MinMaxAggPath *best_path);
static WindowAgg *create_windowagg_plan(PlannerInfo *root, WindowAggPath *best_path);
static SetOp *create_setop_plan(PlannerInfo *root, SetOpPath *best_path,
- int flags);
+ int flags);
static RecursiveUnion *create_recursiveunion_plan(PlannerInfo *root, RecursiveUnionPath *best_path);
static LockRows *create_lockrows_plan(PlannerInfo *root, LockRowsPath *best_path,
- int flags);
+ int flags);
static ModifyTable *create_modifytable_plan(PlannerInfo *root, ModifyTablePath *best_path);
static Limit *create_limit_plan(PlannerInfo *root, LimitPath *best_path,
- int flags);
+ int flags);
static SeqScan *create_seqscan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static SampleScan *create_samplescan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static Scan *create_indexscan_plan(PlannerInfo *root, IndexPath *best_path,
- List *tlist, List *scan_clauses, bool indexonly);
+ List *tlist, List *scan_clauses, bool indexonly);
static BitmapHeapScan *create_bitmap_scan_plan(PlannerInfo *root,
- BitmapHeapPath *best_path,
- List *tlist, List *scan_clauses);
+ BitmapHeapPath *best_path,
+ List *tlist, List *scan_clauses);
static Plan *create_bitmap_subplan(PlannerInfo *root, Path *bitmapqual,
- List **qual, List **indexqual, List **indexECs);
+ List **qual, List **indexqual, List **indexECs);
static void bitmap_subplan_mark_shared(Plan *plan);
static TidScan *create_tidscan_plan(PlannerInfo *root, TidPath *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static SubqueryScan *create_subqueryscan_plan(PlannerInfo *root,
- SubqueryScanPath *best_path,
- List *tlist, List *scan_clauses);
+ SubqueryScanPath *best_path,
+ List *tlist, List *scan_clauses);
static FunctionScan *create_functionscan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static ValuesScan *create_valuesscan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static TableFuncScan *create_tablefuncscan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static CteScan *create_ctescan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static NamedTuplestoreScan *create_namedtuplestorescan_plan(PlannerInfo *root,
- Path *best_path, List *tlist, List *scan_clauses);
+ Path *best_path, List *tlist, List *scan_clauses);
static Result *create_resultscan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static ForeignScan *create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static CustomScan *create_customscan_plan(PlannerInfo *root,
- CustomPath *best_path,
- List *tlist, List *scan_clauses);
+ CustomPath *best_path,
+ List *tlist, List *scan_clauses);
static NestLoop *create_nestloop_plan(PlannerInfo *root, NestPath *best_path);
static MergeJoin *create_mergejoin_plan(PlannerInfo *root, MergePath *best_path);
static HashJoin *create_hashjoin_plan(PlannerInfo *root, HashPath *best_path);
static Node *replace_nestloop_params(PlannerInfo *root, Node *expr);
static Node *replace_nestloop_params_mutator(Node *node, PlannerInfo *root);
static void fix_indexqual_references(PlannerInfo *root, IndexPath *index_path,
- List **stripped_indexquals_p,
- List **fixed_indexquals_p);
+ List **stripped_indexquals_p,
+ List **fixed_indexquals_p);
static List *fix_indexorderby_references(PlannerInfo *root, IndexPath *index_path);
static Node *fix_indexqual_clause(PlannerInfo *root,
- IndexOptInfo *index, int indexcol,
- Node *clause, List *indexcolnos);
+ IndexOptInfo *index, int indexcol,
+ Node *clause, List *indexcolnos);
static Node *fix_indexqual_operand(Node *node, IndexOptInfo *index, int indexcol);
static List *get_switched_clauses(List *clauses, Relids outerrelids);
static List *order_qual_clauses(PlannerInfo *root, List *clauses);
static void copy_generic_path_info(Plan *dest, Path *src);
static void copy_plan_costsize(Plan *dest, Plan *src);
static void label_sort_with_costsize(PlannerInfo *root, Sort *plan,
- double limit_tuples);
+ double limit_tuples);
static SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid);
static SampleScan *make_samplescan(List *qptlist, List *qpqual, Index scanrelid,
- TableSampleClause *tsc);
+ TableSampleClause *tsc);
static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
- Oid indexid, List *indexqual, List *indexqualorig,
- List *indexorderby, List *indexorderbyorig,
- List *indexorderbyops,
- ScanDirection indexscandir);
+ Oid indexid, List *indexqual, List *indexqualorig,
+ List *indexorderby, List *indexorderbyorig,
+ List *indexorderbyops,
+ ScanDirection indexscandir);
static IndexOnlyScan *make_indexonlyscan(List *qptlist, List *qpqual,
- Index scanrelid, Oid indexid,
- List *indexqual, List *indexorderby,
- List *indextlist,
- ScanDirection indexscandir);
+ Index scanrelid, Oid indexid,
+ List *indexqual, List *indexorderby,
+ List *indextlist,
+ ScanDirection indexscandir);
static BitmapIndexScan *make_bitmap_indexscan(Index scanrelid, Oid indexid,
- List *indexqual,
- List *indexqualorig);
+ List *indexqual,
+ List *indexqualorig);
static BitmapHeapScan *make_bitmap_heapscan(List *qptlist,
- List *qpqual,
- Plan *lefttree,
- List *bitmapqualorig,
- Index scanrelid);
+ List *qpqual,
+ Plan *lefttree,
+ List *bitmapqualorig,
+ Index scanrelid);
static TidScan *make_tidscan(List *qptlist, List *qpqual, Index scanrelid,
- List *tidquals);
+ List *tidquals);
static SubqueryScan *make_subqueryscan(List *qptlist,
- List *qpqual,
- Index scanrelid,
- Plan *subplan);
+ List *qpqual,
+ Index scanrelid,
+ Plan *subplan);
static FunctionScan *make_functionscan(List *qptlist, List *qpqual,
- Index scanrelid, List *functions, bool funcordinality);
+ Index scanrelid, List *functions, bool funcordinality);
static ValuesScan *make_valuesscan(List *qptlist, List *qpqual,
- Index scanrelid, List *values_lists);
+ Index scanrelid, List *values_lists);
static TableFuncScan *make_tablefuncscan(List *qptlist, List *qpqual,
- Index scanrelid, TableFunc *tablefunc);
+ Index scanrelid, TableFunc *tablefunc);
static CteScan *make_ctescan(List *qptlist, List *qpqual,
- Index scanrelid, int ctePlanId, int cteParam);
+ Index scanrelid, int ctePlanId, int cteParam);
static NamedTuplestoreScan *make_namedtuplestorescan(List *qptlist, List *qpqual,
- Index scanrelid, char *enrname);
+ Index scanrelid, char *enrname);
static WorkTableScan *make_worktablescan(List *qptlist, List *qpqual,
- Index scanrelid, int wtParam);
+ Index scanrelid, int wtParam);
static RecursiveUnion *make_recursive_union(List *tlist,
- Plan *lefttree,
- Plan *righttree,
- int wtParam,
- List *distinctList,
- long numGroups);
+ Plan *lefttree,
+ Plan *righttree,
+ int wtParam,
+ List *distinctList,
+ long numGroups);
static BitmapAnd *make_bitmap_and(List *bitmapplans);
static BitmapOr *make_bitmap_or(List *bitmapplans);
static NestLoop *make_nestloop(List *tlist,
- List *joinclauses, List *otherclauses, List *nestParams,
- Plan *lefttree, Plan *righttree,
- JoinType jointype, bool inner_unique);
+ List *joinclauses, List *otherclauses, List *nestParams,
+ Plan *lefttree, Plan *righttree,
+ JoinType jointype, bool inner_unique);
static HashJoin *make_hashjoin(List *tlist,
- List *joinclauses, List *otherclauses,
- List *hashclauses,
- Plan *lefttree, Plan *righttree,
- JoinType jointype, bool inner_unique);
+ List *joinclauses, List *otherclauses,
+ List *hashclauses,
+ Plan *lefttree, Plan *righttree,
+ JoinType jointype, bool inner_unique);
static Hash *make_hash(Plan *lefttree,
- Oid skewTable,
- AttrNumber skewColumn,
- bool skewInherit);
+ Oid skewTable,
+ AttrNumber skewColumn,
+ bool skewInherit);
static MergeJoin *make_mergejoin(List *tlist,
- List *joinclauses, List *otherclauses,
- List *mergeclauses,
- Oid *mergefamilies,
- Oid *mergecollations,
- int *mergestrategies,
- bool *mergenullsfirst,
- Plan *lefttree, Plan *righttree,
- JoinType jointype, bool inner_unique,
- bool skip_mark_restore);
+ List *joinclauses, List *otherclauses,
+ List *mergeclauses,
+ Oid *mergefamilies,
+ Oid *mergecollations,
+ int *mergestrategies,
+ bool *mergenullsfirst,
+ Plan *lefttree, Plan *righttree,
+ JoinType jointype, bool inner_unique,
+ bool skip_mark_restore);
static Sort *make_sort(Plan *lefttree, int numCols,
- AttrNumber *sortColIdx, Oid *sortOperators,
- Oid *collations, bool *nullsFirst);
+ AttrNumber *sortColIdx, Oid *sortOperators,
+ Oid *collations, bool *nullsFirst);
static Plan *prepare_sort_from_pathkeys(Plan *lefttree, List *pathkeys,
- Relids relids,
- const AttrNumber *reqColIdx,
- bool adjust_tlist_in_place,
- int *p_numsortkeys,
- AttrNumber **p_sortColIdx,
- Oid **p_sortOperators,
- Oid **p_collations,
- bool **p_nullsFirst);
+ Relids relids,
+ const AttrNumber *reqColIdx,
+ bool adjust_tlist_in_place,
+ int *p_numsortkeys,
+ AttrNumber **p_sortColIdx,
+ Oid **p_sortOperators,
+ Oid **p_collations,
+ bool **p_nullsFirst);
static EquivalenceMember *find_ec_member_for_tle(EquivalenceClass *ec,
- TargetEntry *tle,
- Relids relids);
+ TargetEntry *tle,
+ Relids relids);
static Sort *make_sort_from_pathkeys(Plan *lefttree, List *pathkeys,
- Relids relids);
+ Relids relids);
static Sort *make_sort_from_groupcols(List *groupcls,
- AttrNumber *grpColIdx,
- Plan *lefttree);
+ AttrNumber *grpColIdx,
+ Plan *lefttree);
static Material *make_material(Plan *lefttree);
static WindowAgg *make_windowagg(List *tlist, Index winref,
- int partNumCols, AttrNumber *partColIdx, Oid *partOperators, Oid *partCollations,
- int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, Oid *ordCollations,
- int frameOptions, Node *startOffset, Node *endOffset,
- Oid startInRangeFunc, Oid endInRangeFunc,
- Oid inRangeColl, bool inRangeAsc, bool inRangeNullsFirst,
- Plan *lefttree);
+ int partNumCols, AttrNumber *partColIdx, Oid *partOperators, Oid *partCollations,
+ int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, Oid *ordCollations,
+ int frameOptions, Node *startOffset, Node *endOffset,
+ Oid startInRangeFunc, Oid endInRangeFunc,
+ Oid inRangeColl, bool inRangeAsc, bool inRangeNullsFirst,
+ Plan *lefttree);
static Group *make_group(List *tlist, List *qual, int numGroupCols,
- AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations,
- Plan *lefttree);
+ AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations,
+ Plan *lefttree);
static Unique *make_unique_from_sortclauses(Plan *lefttree, List *distinctList);
static Unique *make_unique_from_pathkeys(Plan *lefttree,
- List *pathkeys, int numCols);
+ List *pathkeys, int numCols);
static Gather *make_gather(List *qptlist, List *qpqual,
- int nworkers, int rescan_param, bool single_copy, Plan *subplan);
+ int nworkers, int rescan_param, bool single_copy, Plan *subplan);
static SetOp *make_setop(SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree,
- List *distinctList, AttrNumber flagColIdx, int firstFlag,
- long numGroups);
+ List *distinctList, AttrNumber flagColIdx, int firstFlag,
+ long numGroups);
static LockRows *make_lockrows(Plan *lefttree, List *rowMarks, int epqParam);
static Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
static ProjectSet *make_project_set(List *tlist, Plan *subplan);
static ModifyTable *make_modifytable(PlannerInfo *root,
- CmdType operation, bool canSetTag,
- Index nominalRelation, Index rootRelation,
- bool partColsUpdated,
- List *resultRelations, List *subplans, List *subroots,
- List *withCheckOptionLists, List *returningLists,
- List *rowMarks, OnConflictExpr *onconflict, int epqParam);
+ CmdType operation, bool canSetTag,
+ Index nominalRelation, Index rootRelation,
+ bool partColsUpdated,
+ List *resultRelations, List *subplans, List *subroots,
+ List *withCheckOptionLists, List *returningLists,
+ List *rowMarks, OnConflictExpr *onconflict, int epqParam);
static GatherMerge *create_gather_merge_plan(PlannerInfo *root,
- GatherMergePath *best_path);
+ GatherMergePath *best_path);
/*
static void extract_lateral_references(PlannerInfo *root, RelOptInfo *brel,
- Index rtindex);
+ Index rtindex);
static List *deconstruct_recurse(PlannerInfo *root, Node *jtnode,
- bool below_outer_join,
- Relids *qualscope, Relids *inner_join_rels,
- List **postponed_qual_list);
+ bool below_outer_join,
+ Relids *qualscope, Relids *inner_join_rels,
+ List **postponed_qual_list);
static void process_security_barrier_quals(PlannerInfo *root,
- int rti, Relids qualscope,
- bool below_outer_join);
+ int rti, Relids qualscope,
+ bool below_outer_join);
static SpecialJoinInfo *make_outerjoininfo(PlannerInfo *root,
- Relids left_rels, Relids right_rels,
- Relids inner_join_rels,
- JoinType jointype, List *clause);
+ Relids left_rels, Relids right_rels,
+ Relids inner_join_rels,
+ JoinType jointype, List *clause);
static void compute_semijoin_info(SpecialJoinInfo *sjinfo, List *clause);
static void distribute_qual_to_rels(PlannerInfo *root, Node *clause,
- bool is_deduced,
- bool below_outer_join,
- JoinType jointype,
- Index security_level,
- Relids qualscope,
- Relids ojscope,
- Relids outerjoin_nonnullable,
- Relids deduced_nullable_relids,
- List **postponed_qual_list);
+ bool is_deduced,
+ bool below_outer_join,
+ JoinType jointype,
+ Index security_level,
+ Relids qualscope,
+ Relids ojscope,
+ Relids outerjoin_nonnullable,
+ Relids deduced_nullable_relids,
+ List **postponed_qual_list);
static bool check_outerjoin_delay(PlannerInfo *root, Relids *relids_p,
- Relids *nullable_relids_p, bool is_pushed_down);
+ Relids *nullable_relids_p, bool is_pushed_down);
static bool check_equivalence_delay(PlannerInfo *root,
- RestrictInfo *restrictinfo);
+ RestrictInfo *restrictinfo);
static bool check_redundant_nullability_qual(PlannerInfo *root, Node *clause);
static void check_mergejoinable(RestrictInfo *restrictinfo);
static void check_hashjoinable(RestrictInfo *restrictinfo);
static bool find_minmax_aggs_walker(Node *node, List **context);
static bool build_minmax_path(PlannerInfo *root, MinMaxAggInfo *mminfo,
- Oid eqop, Oid sortop, bool nulls_first);
+ Oid eqop, Oid sortop, bool nulls_first);
static void minmax_qp_callback(PlannerInfo *root, void *extra);
static Oid fetch_agg_sort_op(Oid aggfnoid);
static void preprocess_qual_conditions(PlannerInfo *root, Node *jtnode);
static void inheritance_planner(PlannerInfo *root);
static void grouping_planner(PlannerInfo *root, bool inheritance_update,
- double tuple_fraction);
+ double tuple_fraction);
static grouping_sets_data *preprocess_grouping_sets(PlannerInfo *root);
static List *remap_to_groupclause_idx(List *groupClause, List *gsets,
- int *tleref_to_colnum_map);
+ int *tleref_to_colnum_map);
static void preprocess_rowmarks(PlannerInfo *root);
static double preprocess_limit(PlannerInfo *root,
- double tuple_fraction,
- int64 *offset_est, int64 *count_est);
+ double tuple_fraction,
+ int64 *offset_est, int64 *count_est);
static void remove_useless_groupby_columns(PlannerInfo *root);
static List *preprocess_groupclause(PlannerInfo *root, List *force);
static List *extract_rollup_sets(List *groupingSets);
static List *reorder_grouping_sets(List *groupingSets, List *sortclause);
static void standard_qp_callback(PlannerInfo *root, void *extra);
static double get_number_of_groups(PlannerInfo *root,
- double path_rows,
- grouping_sets_data *gd,
- List *target_list);
+ double path_rows,
+ grouping_sets_data *gd,
+ List *target_list);
static RelOptInfo *create_grouping_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- PathTarget *target,
- bool target_parallel_safe,
- const AggClauseCosts *agg_costs,
- grouping_sets_data *gd);
+ RelOptInfo *input_rel,
+ PathTarget *target,
+ bool target_parallel_safe,
+ const AggClauseCosts *agg_costs,
+ grouping_sets_data *gd);
static bool is_degenerate_grouping(PlannerInfo *root);
static void create_degenerate_grouping_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- RelOptInfo *grouped_rel);
+ RelOptInfo *input_rel,
+ RelOptInfo *grouped_rel);
static RelOptInfo *make_grouping_rel(PlannerInfo *root, RelOptInfo *input_rel,
- PathTarget *target, bool target_parallel_safe,
- Node *havingQual);
+ PathTarget *target, bool target_parallel_safe,
+ Node *havingQual);
static void create_ordinary_grouping_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- RelOptInfo *grouped_rel,
- const AggClauseCosts *agg_costs,
- grouping_sets_data *gd,
- GroupPathExtraData *extra,
- RelOptInfo **partially_grouped_rel_p);
+ RelOptInfo *input_rel,
+ RelOptInfo *grouped_rel,
+ const AggClauseCosts *agg_costs,
+ grouping_sets_data *gd,
+ GroupPathExtraData *extra,
+ RelOptInfo **partially_grouped_rel_p);
static void consider_groupingsets_paths(PlannerInfo *root,
- RelOptInfo *grouped_rel,
- Path *path,
- bool is_sorted,
- bool can_hash,
- grouping_sets_data *gd,
- const AggClauseCosts *agg_costs,
- double dNumGroups);
+ RelOptInfo *grouped_rel,
+ Path *path,
+ bool is_sorted,
+ bool can_hash,
+ grouping_sets_data *gd,
+ const AggClauseCosts *agg_costs,
+ double dNumGroups);
static RelOptInfo *create_window_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- PathTarget *input_target,
- PathTarget *output_target,
- bool output_target_parallel_safe,
- WindowFuncLists *wflists,
- List *activeWindows);
+ RelOptInfo *input_rel,
+ PathTarget *input_target,
+ PathTarget *output_target,
+ bool output_target_parallel_safe,
+ WindowFuncLists *wflists,
+ List *activeWindows);
static void create_one_window_path(PlannerInfo *root,
- RelOptInfo *window_rel,
- Path *path,
- PathTarget *input_target,
- PathTarget *output_target,
- WindowFuncLists *wflists,
- List *activeWindows);
+ RelOptInfo *window_rel,
+ Path *path,
+ PathTarget *input_target,
+ PathTarget *output_target,
+ WindowFuncLists *wflists,
+ List *activeWindows);
static RelOptInfo *create_distinct_paths(PlannerInfo *root,
- RelOptInfo *input_rel);
+ RelOptInfo *input_rel);
static RelOptInfo *create_ordered_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- PathTarget *target,
- bool target_parallel_safe,
- double limit_tuples);
+ RelOptInfo *input_rel,
+ PathTarget *target,
+ bool target_parallel_safe,
+ double limit_tuples);
static PathTarget *make_group_input_target(PlannerInfo *root,
- PathTarget *final_target);
+ PathTarget *final_target);
static PathTarget *make_partial_grouping_target(PlannerInfo *root,
- PathTarget *grouping_target,
- Node *havingQual);
+ PathTarget *grouping_target,
+ Node *havingQual);
static List *postprocess_setop_tlist(List *new_tlist, List *orig_tlist);
static List *select_active_windows(PlannerInfo *root, WindowFuncLists *wflists);
static PathTarget *make_window_input_target(PlannerInfo *root,
- PathTarget *final_target,
- List *activeWindows);
+ PathTarget *final_target,
+ List *activeWindows);
static List *make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc,
- List *tlist);
+ List *tlist);
static PathTarget *make_sort_input_target(PlannerInfo *root,
- PathTarget *final_target,
- bool *have_postponed_srfs);
+ PathTarget *final_target,
+ bool *have_postponed_srfs);
static void adjust_paths_for_srfs(PlannerInfo *root, RelOptInfo *rel,
- List *targets, List *targets_contain_srfs);
+ List *targets, List *targets_contain_srfs);
static void add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo *input_rel,
- RelOptInfo *grouped_rel,
- RelOptInfo *partially_grouped_rel,
- const AggClauseCosts *agg_costs,
- grouping_sets_data *gd,
- double dNumGroups,
- GroupPathExtraData *extra);
+ RelOptInfo *grouped_rel,
+ RelOptInfo *partially_grouped_rel,
+ const AggClauseCosts *agg_costs,
+ grouping_sets_data *gd,
+ double dNumGroups,
+ GroupPathExtraData *extra);
static RelOptInfo *create_partial_grouping_paths(PlannerInfo *root,
- RelOptInfo *grouped_rel,
- RelOptInfo *input_rel,
- grouping_sets_data *gd,
- GroupPathExtraData *extra,
- bool force_rel_creation);
+ RelOptInfo *grouped_rel,
+ RelOptInfo *input_rel,
+ grouping_sets_data *gd,
+ GroupPathExtraData *extra,
+ bool force_rel_creation);
static void gather_grouping_paths(PlannerInfo *root, RelOptInfo *rel);
static bool can_partial_agg(PlannerInfo *root,
- const AggClauseCosts *agg_costs);
+ const AggClauseCosts *agg_costs);
static void apply_scanjoin_target_to_paths(PlannerInfo *root,
- RelOptInfo *rel,
- List *scanjoin_targets,
- List *scanjoin_targets_contain_srfs,
- bool scanjoin_target_parallel_safe,
- bool tlist_same_exprs);
+ RelOptInfo *rel,
+ List *scanjoin_targets,
+ List *scanjoin_targets_contain_srfs,
+ bool scanjoin_target_parallel_safe,
+ bool tlist_same_exprs);
static void create_partitionwise_grouping_paths(PlannerInfo *root,
- RelOptInfo *input_rel,
- RelOptInfo *grouped_rel,
- RelOptInfo *partially_grouped_rel,
- const AggClauseCosts *agg_costs,
- grouping_sets_data *gd,
- PartitionwiseAggregateType patype,
- GroupPathExtraData *extra);
+ RelOptInfo *input_rel,
+ RelOptInfo *grouped_rel,
+ RelOptInfo *partially_grouped_rel,
+ const AggClauseCosts *agg_costs,
+ grouping_sets_data *gd,
+ PartitionwiseAggregateType patype,
+ GroupPathExtraData *extra);
static bool group_by_has_partkey(RelOptInfo *input_rel,
- List *targetList,
- List *groupClause);
+ List *targetList,
+ List *groupClause);
static int common_prefix_cmp(const void *a, const void *b);
static void add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte);
static Plan *set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset);
static Plan *set_indexonlyscan_references(PlannerInfo *root,
- IndexOnlyScan *plan,
- int rtoffset);
+ IndexOnlyScan *plan,
+ int rtoffset);
static Plan *set_subqueryscan_references(PlannerInfo *root,
- SubqueryScan *plan,
- int rtoffset);
+ SubqueryScan *plan,
+ int rtoffset);
static bool trivial_subqueryscan(SubqueryScan *plan);
static Plan *clean_up_removed_plan_level(Plan *parent, Plan *child);
static void set_foreignscan_references(PlannerInfo *root,
- ForeignScan *fscan,
- int rtoffset);
+ ForeignScan *fscan,
+ int rtoffset);
static void set_customscan_references(PlannerInfo *root,
- CustomScan *cscan,
- int rtoffset);
+ CustomScan *cscan,
+ int rtoffset);
static Plan *set_append_references(PlannerInfo *root,
- Append *aplan,
- int rtoffset);
+ Append *aplan,
+ int rtoffset);
static Plan *set_mergeappend_references(PlannerInfo *root,
- MergeAppend *mplan,
- int rtoffset);
+ MergeAppend *mplan,
+ int rtoffset);
static Node *fix_scan_expr(PlannerInfo *root, Node *node, int rtoffset);
static Node *fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context);
static bool fix_scan_expr_walker(Node *node, fix_scan_expr_context *context);
static void set_dummy_tlist_references(Plan *plan, int rtoffset);
static indexed_tlist *build_tlist_index(List *tlist);
static Var *search_indexed_tlist_for_var(Var *var,
- indexed_tlist *itlist,
- Index newvarno,
- int rtoffset);
+ indexed_tlist *itlist,
+ Index newvarno,
+ int rtoffset);
static Var *search_indexed_tlist_for_non_var(Expr *node,
- indexed_tlist *itlist,
- Index newvarno);
+ indexed_tlist *itlist,
+ Index newvarno);
static Var *search_indexed_tlist_for_sortgroupref(Expr *node,
- Index sortgroupref,
- indexed_tlist *itlist,
- Index newvarno);
+ Index sortgroupref,
+ indexed_tlist *itlist,
+ Index newvarno);
static List *fix_join_expr(PlannerInfo *root,
- List *clauses,
- indexed_tlist *outer_itlist,
- indexed_tlist *inner_itlist,
- Index acceptable_rel, int rtoffset);
+ List *clauses,
+ indexed_tlist *outer_itlist,
+ indexed_tlist *inner_itlist,
+ Index acceptable_rel, int rtoffset);
static Node *fix_join_expr_mutator(Node *node,
- fix_join_expr_context *context);
+ fix_join_expr_context *context);
static Node *fix_upper_expr(PlannerInfo *root,
- Node *node,
- indexed_tlist *subplan_itlist,
- Index newvarno,
- int rtoffset);
+ Node *node,
+ indexed_tlist *subplan_itlist,
+ Index newvarno,
+ int rtoffset);
static Node *fix_upper_expr_mutator(Node *node,
- fix_upper_expr_context *context);
+ fix_upper_expr_context *context);
static List *set_returning_clause_references(PlannerInfo *root,
- List *rlist,
- Plan *topplan,
- Index resultRelation,
- int rtoffset);
+ List *rlist,
+ Plan *topplan,
+ Index resultRelation,
+ int rtoffset);
/*****************************************************************************
static Node *build_subplan(PlannerInfo *root, Plan *plan, PlannerInfo *subroot,
- List *plan_params,
- SubLinkType subLinkType, int subLinkId,
- Node *testexpr, bool adjust_testexpr,
- bool unknownEqFalse);
+ List *plan_params,
+ SubLinkType subLinkType, int subLinkId,
+ Node *testexpr, bool adjust_testexpr,
+ bool unknownEqFalse);
static List *generate_subquery_params(PlannerInfo *root, List *tlist,
- List **paramIds);
+ List **paramIds);
static List *generate_subquery_vars(PlannerInfo *root, List *tlist,
- Index varno);
+ Index varno);
static Node *convert_testexpr(PlannerInfo *root,
- Node *testexpr,
- List *subst_nodes);
+ Node *testexpr,
+ List *subst_nodes);
static Node *convert_testexpr_mutator(Node *node,
- convert_testexpr_context *context);
+ convert_testexpr_context *context);
static bool subplan_is_hashable(Plan *plan);
static bool testexpr_is_hashable(Node *testexpr);
static bool hash_ok_operator(OpExpr *expr);
static bool inline_cte_walker(Node *node, inline_cte_walker_context *context);
static bool simplify_EXISTS_query(PlannerInfo *root, Query *query);
static Query *convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect,
- Node **testexpr, List **paramIds);
+ Node **testexpr, List **paramIds);
static Node *replace_correlation_vars_mutator(Node *node, PlannerInfo *root);
static Node *process_sublinks_mutator(Node *node,
- process_sublinks_context *context);
+ process_sublinks_context *context);
static Bitmapset *finalize_plan(PlannerInfo *root,
- Plan *plan,
- int gather_param,
- Bitmapset *valid_params,
- Bitmapset *scan_params);
+ Plan *plan,
+ int gather_param,
+ Bitmapset *valid_params,
+ Bitmapset *scan_params);
static bool finalize_primnode(Node *node, finalize_primnode_context *context);
static bool finalize_agg_primnode(Node *node, finalize_primnode_context *context);
} reduce_outer_joins_state;
static Node *pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
- Relids *relids);
+ Relids *relids);
static Node *pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node,
- Node **jtlink1, Relids available_rels1,
- Node **jtlink2, Relids available_rels2);
+ Node **jtlink1, Relids available_rels1,
+ Node **jtlink2, Relids available_rels2);
static Node *pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
- JoinExpr *lowest_outer_join,
- JoinExpr *lowest_nulling_outer_join,
- AppendRelInfo *containing_appendrel);
+ JoinExpr *lowest_outer_join,
+ JoinExpr *lowest_nulling_outer_join,
+ AppendRelInfo *containing_appendrel);
static Node *pull_up_simple_subquery(PlannerInfo *root, Node *jtnode,
- RangeTblEntry *rte,
- JoinExpr *lowest_outer_join,
- JoinExpr *lowest_nulling_outer_join,
- AppendRelInfo *containing_appendrel);
+ RangeTblEntry *rte,
+ JoinExpr *lowest_outer_join,
+ JoinExpr *lowest_nulling_outer_join,
+ AppendRelInfo *containing_appendrel);
static Node *pull_up_simple_union_all(PlannerInfo *root, Node *jtnode,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void pull_up_union_leaf_queries(Node *setOp, PlannerInfo *root,
- int parentRTindex, Query *setOpQuery,
- int childRToffset);
+ int parentRTindex, Query *setOpQuery,
+ int childRToffset);
static void make_setop_translation_list(Query *query, Index newvarno,
- List **translated_vars);
+ List **translated_vars);
static bool is_simple_subquery(Query *subquery, RangeTblEntry *rte,
- JoinExpr *lowest_outer_join);
+ JoinExpr *lowest_outer_join);
static Node *pull_up_simple_values(PlannerInfo *root, Node *jtnode,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static bool is_simple_values(PlannerInfo *root, RangeTblEntry *rte);
static bool is_simple_union_all(Query *subquery);
static bool is_simple_union_all_recurse(Node *setOp, Query *setOpQuery,
- List *colTypes);
+ List *colTypes);
static bool is_safe_append_member(Query *subquery);
static bool jointree_contains_lateral_outer_refs(Node *jtnode, bool restricted,
- Relids safe_upper_varnos);
+ Relids safe_upper_varnos);
static void replace_vars_in_jointree(Node *jtnode,
- pullup_replace_vars_context *context,
- JoinExpr *lowest_nulling_outer_join);
+ pullup_replace_vars_context *context,
+ JoinExpr *lowest_nulling_outer_join);
static Node *pullup_replace_vars(Node *expr,
- pullup_replace_vars_context *context);
+ pullup_replace_vars_context *context);
static Node *pullup_replace_vars_callback(Var *var,
- replace_rte_variables_context *context);
+ replace_rte_variables_context *context);
static Query *pullup_replace_vars_subquery(Query *query,
- pullup_replace_vars_context *context);
+ pullup_replace_vars_context *context);
static reduce_outer_joins_state *reduce_outer_joins_pass1(Node *jtnode);
static void reduce_outer_joins_pass2(Node *jtnode,
- reduce_outer_joins_state *state,
- PlannerInfo *root,
- Relids nonnullable_rels,
- List *nonnullable_vars,
- List *forced_null_vars);
+ reduce_outer_joins_state *state,
+ PlannerInfo *root,
+ Relids nonnullable_rels,
+ List *nonnullable_vars,
+ List *forced_null_vars);
static Node *remove_useless_results_recurse(PlannerInfo *root, Node *jtnode);
static int get_result_relid(PlannerInfo *root, Node *jtnode);
static void remove_result_refs(PlannerInfo *root, int varno, Node *newjtloc);
static bool find_dependent_phvs(Node *node, int varno);
static void substitute_phv_relids(Node *node,
- int varno, Relids subrelids);
+ int varno, Relids subrelids);
static void fix_append_rel_relids(List *append_rel_list, int varno,
- Relids subrelids);
+ Relids subrelids);
static Node *find_jointree_node_for_rel(Node *jtnode, int relid);
static List *expand_targetlist(List *tlist, int command_type,
- Index result_relation, Relation rel);
+ Index result_relation, Relation rel);
/*
static RelOptInfo *recurse_set_operations(Node *setOp, PlannerInfo *root,
- List *colTypes, List *colCollations,
- bool junkOK,
- int flag, List *refnames_tlist,
- List **pTargetList,
- double *pNumGroups);
+ List *colTypes, List *colCollations,
+ bool junkOK,
+ int flag, List *refnames_tlist,
+ List **pTargetList,
+ double *pNumGroups);
static RelOptInfo *generate_recursion_path(SetOperationStmt *setOp,
- PlannerInfo *root,
- List *refnames_tlist,
- List **pTargetList);
+ PlannerInfo *root,
+ List *refnames_tlist,
+ List **pTargetList);
static RelOptInfo *generate_union_paths(SetOperationStmt *op, PlannerInfo *root,
- List *refnames_tlist,
- List **pTargetList);
+ List *refnames_tlist,
+ List **pTargetList);
static RelOptInfo *generate_nonunion_paths(SetOperationStmt *op, PlannerInfo *root,
- List *refnames_tlist,
- List **pTargetList);
+ List *refnames_tlist,
+ List **pTargetList);
static List *plan_union_children(PlannerInfo *root,
- SetOperationStmt *top_union,
- List *refnames_tlist,
- List **tlist_list);
+ SetOperationStmt *top_union,
+ List *refnames_tlist,
+ List **tlist_list);
static Path *make_union_unique(SetOperationStmt *op, Path *path, List *tlist,
- PlannerInfo *root);
+ PlannerInfo *root);
static void postprocess_setop_rel(PlannerInfo *root, RelOptInfo *rel);
static bool choose_hashed_setop(PlannerInfo *root, List *groupClauses,
- Path *input_path,
- double dNumGroups, double dNumOutputRows,
- const char *construct);
+ Path *input_path,
+ double dNumGroups, double dNumOutputRows,
+ const char *construct);
static List *generate_setop_tlist(List *colTypes, List *colCollations,
- int flag,
- Index varno,
- bool hack_constants,
- List *input_tlist,
- List *refnames_tlist);
+ int flag,
+ Index varno,
+ bool hack_constants,
+ List *input_tlist,
+ List *refnames_tlist);
static List *generate_append_tlist(List *colTypes, List *colCollations,
- bool flag,
- List *input_tlists,
- List *refnames_tlist);
+ bool flag,
+ List *input_tlists,
+ List *refnames_tlist);
static List *generate_setop_grouplist(SetOperationStmt *op, List *targetlist);
} adjust_appendrel_attrs_context;
static void make_inh_translation_list(Relation oldrelation,
- Relation newrelation,
- Index newvarno,
- List **translated_vars);
+ Relation newrelation,
+ Index newvarno,
+ List **translated_vars);
static Node *adjust_appendrel_attrs_mutator(Node *node,
- adjust_appendrel_attrs_context *context);
+ adjust_appendrel_attrs_context *context);
static List *adjust_inherited_tlist(List *tlist,
- AppendRelInfo *context);
+ AppendRelInfo *context);
/*
static bool contain_agg_clause_walker(Node *node, void *context);
static bool get_agg_clause_costs_walker(Node *node,
- get_agg_clause_costs_context *context);
+ get_agg_clause_costs_context *context);
static bool find_window_functions_walker(Node *node, WindowFuncLists *lists);
static bool contain_subplans_walker(Node *node, void *context);
static bool contain_mutable_functions_walker(Node *node, void *context);
static bool contain_volatile_functions_walker(Node *node, void *context);
static bool contain_volatile_functions_not_nextval_walker(Node *node, void *context);
static bool max_parallel_hazard_walker(Node *node,
- max_parallel_hazard_context *context);
+ max_parallel_hazard_context *context);
static bool contain_nonstrict_functions_walker(Node *node, void *context);
static bool contain_context_dependent_node(Node *clause);
static bool contain_context_dependent_node_walker(Node *node, int *flags);
static List *find_nonnullable_vars_walker(Node *node, bool top_level);
static bool is_strict_saop(ScalarArrayOpExpr *expr, bool falseOK);
static Node *eval_const_expressions_mutator(Node *node,
- eval_const_expressions_context *context);
+ eval_const_expressions_context *context);
static bool contain_non_const_walker(Node *node, void *context);
static bool ece_function_is_safe(Oid funcid,
- eval_const_expressions_context *context);
+ eval_const_expressions_context *context);
static List *simplify_or_arguments(List *args,
- eval_const_expressions_context *context,
- bool *haveNull, bool *forceTrue);
+ eval_const_expressions_context *context,
+ bool *haveNull, bool *forceTrue);
static List *simplify_and_arguments(List *args,
- eval_const_expressions_context *context,
- bool *haveNull, bool *forceFalse);
+ eval_const_expressions_context *context,
+ bool *haveNull, bool *forceFalse);
static Node *simplify_boolean_equality(Oid opno, List *args);
static Expr *simplify_function(Oid funcid,
- Oid result_type, int32 result_typmod,
- Oid result_collid, Oid input_collid, List **args_p,
- bool funcvariadic, bool process_args, bool allow_non_const,
- eval_const_expressions_context *context);
+ Oid result_type, int32 result_typmod,
+ Oid result_collid, Oid input_collid, List **args_p,
+ bool funcvariadic, bool process_args, bool allow_non_const,
+ eval_const_expressions_context *context);
static List *reorder_function_arguments(List *args, HeapTuple func_tuple);
static List *add_function_defaults(List *args, HeapTuple func_tuple);
static List *fetch_function_defaults(HeapTuple func_tuple);
static void recheck_cast_function_args(List *args, Oid result_type,
- HeapTuple func_tuple);
+ HeapTuple func_tuple);
static Expr *evaluate_function(Oid funcid, Oid result_type, int32 result_typmod,
- Oid result_collid, Oid input_collid, List *args,
- bool funcvariadic,
- HeapTuple func_tuple,
- eval_const_expressions_context *context);
+ Oid result_collid, Oid input_collid, List *args,
+ bool funcvariadic,
+ HeapTuple func_tuple,
+ eval_const_expressions_context *context);
static Expr *inline_function(Oid funcid, Oid result_type, Oid result_collid,
- Oid input_collid, List *args,
- bool funcvariadic,
- HeapTuple func_tuple,
- eval_const_expressions_context *context);
+ Oid input_collid, List *args,
+ bool funcvariadic,
+ HeapTuple func_tuple,
+ eval_const_expressions_context *context);
static Node *substitute_actual_parameters(Node *expr, int nargs, List *args,
- int *usecounts);
+ int *usecounts);
static Node *substitute_actual_parameters_mutator(Node *node,
- substitute_actual_parameters_context *context);
+ substitute_actual_parameters_context *context);
static void sql_inline_error_callback(void *arg);
static Query *substitute_actual_srf_parameters(Query *expr,
- int nargs, List *args);
+ int nargs, List *args);
static Node *substitute_actual_srf_parameters_mutator(Node *node,
- substitute_actual_srf_parameters_context *context);
+ substitute_actual_srf_parameters_context *context);
static bool tlist_matches_coltypelist(List *tlist, List *coltypelist);
static void expand_partitioned_rtentry(PlannerInfo *root, RelOptInfo *relinfo,
- RangeTblEntry *parentrte,
- Index parentRTindex, Relation parentrel,
- PlanRowMark *top_parentrc, LOCKMODE lockmode);
+ RangeTblEntry *parentrte,
+ Index parentRTindex, Relation parentrel,
+ PlanRowMark *top_parentrc, LOCKMODE lockmode);
static void expand_single_inheritance_child(PlannerInfo *root,
- RangeTblEntry *parentrte,
- Index parentRTindex, Relation parentrel,
- PlanRowMark *top_parentrc, Relation childrel,
- RangeTblEntry **childrte_p,
- Index *childRTindex_p);
+ RangeTblEntry *parentrte,
+