From 80bb2b5f20b38f25b2d42342e00e602f2bd4d8a3 Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Thu, 27 Nov 2025 07:01:02 +0000 Subject: [PATCH 1/6] Removing unused function parameters in btree_gist A few parameters are not used, let's remove them. --- contrib/btree_gist/btree_utils_var.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c index 7fbea0cfb7bf..37bd119cb290 100644 --- a/contrib/btree_gist/btree_utils_var.c +++ b/contrib/btree_gist/btree_utils_var.c @@ -166,7 +166,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo) * returns true, if query matches prefix ( common prefix ) */ static bool -gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo *tinfo) +gbt_bytea_pf_match(const bytea *pf, const bytea *query) { bool out = false; int32 qlen = VARSIZE(query) - VARHDRSZ; @@ -191,8 +191,8 @@ static bool gbt_var_node_pf_match(const GBT_VARKEY_R *node, const bytea *query, const gbtree_vinfo *tinfo) { return (tinfo->trnc && - (gbt_bytea_pf_match(node->lower, query, tinfo) || - gbt_bytea_pf_match(node->upper, query, tinfo))); + (gbt_bytea_pf_match(node->lower, query) || + gbt_bytea_pf_match(node->upper, query))); } @@ -201,7 +201,7 @@ gbt_var_node_pf_match(const GBT_VARKEY_R *node, const bytea *query, const gbtree * cpf_length .. common prefix length */ static GBT_VARKEY * -gbt_var_node_truncate(const GBT_VARKEY *node, int32 cpf_length, const gbtree_vinfo *tinfo) +gbt_var_node_truncate(const GBT_VARKEY *node, int32 cpf_length) { GBT_VARKEY *out = NULL; GBT_VARKEY_R r = gbt_var_key_readable(node); @@ -348,7 +348,7 @@ gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, GBT_VARKEY *trc = NULL; plen = gbt_var_node_cp_len((GBT_VARKEY *) DatumGetPointer(out), tinfo); - trc = gbt_var_node_truncate((GBT_VARKEY *) DatumGetPointer(out), plen + 1, tinfo); + trc = gbt_var_node_truncate((GBT_VARKEY *) DatumGetPointer(out), plen + 1); out = PointerGetDatum(trc); } @@ -399,9 +399,9 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, if ((VARSIZE(ok.lower) - VARHDRSZ) == 0 && (VARSIZE(ok.upper) - VARHDRSZ) == 0) *res = 0.0; else if (!((tinfo->f_cmp(nk.lower, ok.lower, collation, flinfo) >= 0 || - gbt_bytea_pf_match(ok.lower, nk.lower, tinfo)) && + gbt_bytea_pf_match(ok.lower, nk.lower)) && (tinfo->f_cmp(nk.upper, ok.upper, collation, flinfo) <= 0 || - gbt_bytea_pf_match(ok.upper, nk.upper, tinfo)))) + gbt_bytea_pf_match(ok.upper, nk.upper)))) { Datum d = PointerGetDatum(0); double dres; @@ -537,8 +537,8 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, ll = Max(ll, lr); ll++; - dl = gbt_var_node_truncate((GBT_VARKEY *) DatumGetPointer(v->spl_ldatum), ll, tinfo); - dr = gbt_var_node_truncate((GBT_VARKEY *) DatumGetPointer(v->spl_rdatum), ll, tinfo); + dl = gbt_var_node_truncate((GBT_VARKEY *) DatumGetPointer(v->spl_ldatum), ll); + dr = gbt_var_node_truncate((GBT_VARKEY *) DatumGetPointer(v->spl_rdatum), ll); v->spl_ldatum = PointerGetDatum(dl); v->spl_rdatum = PointerGetDatum(dr); } From 67369459828d7c998b49e6199f5d8a9cb88635d6 Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Thu, 27 Nov 2025 07:19:20 +0000 Subject: [PATCH 2/6] Removing unused function parameters in pgcrypto A few parameters are not used, let's remove them. --- contrib/pgcrypto/pgcrypto.c | 19 ++++++++----------- contrib/pgcrypto/pgp-pgsql.c | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c index 9ecbbd2e2f86..5b762107e2e4 100644 --- a/contrib/pgcrypto/pgcrypto.c +++ b/contrib/pgcrypto/pgcrypto.c @@ -56,8 +56,7 @@ static const struct config_enum_entry builtin_crypto_options[] = { }; typedef int (*PFN) (const char *name, void **res); -static void *find_provider(text *name, PFN provider_lookup, const char *desc, - int silent); +static void *find_provider(text *name, PFN provider_lookup, int silent); int builtin_crypto_enabled = BC_ON; @@ -98,7 +97,7 @@ pg_digest(PG_FUNCTION_ARGS) name = PG_GETARG_TEXT_PP(1); /* will give error if fails */ - md = find_provider(name, (PFN) px_find_digest, "Digest", 0); + md = find_provider(name, (PFN) px_find_digest, 0); hlen = px_md_result_size(md); @@ -136,7 +135,7 @@ pg_hmac(PG_FUNCTION_ARGS) name = PG_GETARG_TEXT_PP(2); /* will give error if fails */ - h = find_provider(name, (PFN) px_find_hmac, "HMAC", 0); + h = find_provider(name, (PFN) px_find_hmac, 0); hlen = px_hmac_result_size(h); @@ -262,7 +261,7 @@ pg_encrypt(PG_FUNCTION_ARGS) rlen; type = PG_GETARG_TEXT_PP(2); - c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); + c = find_provider(type, (PFN) px_find_combo, 0); data = PG_GETARG_BYTEA_PP(0); key = PG_GETARG_BYTEA_PP(1); @@ -311,7 +310,7 @@ pg_decrypt(PG_FUNCTION_ARGS) rlen; type = PG_GETARG_TEXT_PP(2); - c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); + c = find_provider(type, (PFN) px_find_combo, 0); data = PG_GETARG_BYTEA_PP(0); key = PG_GETARG_BYTEA_PP(1); @@ -361,7 +360,7 @@ pg_encrypt_iv(PG_FUNCTION_ARGS) rlen; type = PG_GETARG_TEXT_PP(3); - c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); + c = find_provider(type, (PFN) px_find_combo, 0); data = PG_GETARG_BYTEA_PP(0); key = PG_GETARG_BYTEA_PP(1); @@ -415,7 +414,7 @@ pg_decrypt_iv(PG_FUNCTION_ARGS) ivlen; type = PG_GETARG_TEXT_PP(3); - c = find_provider(type, (PFN) px_find_combo, "Cipher", 0); + c = find_provider(type, (PFN) px_find_combo, 0); data = PG_GETARG_BYTEA_PP(0); key = PG_GETARG_BYTEA_PP(1); @@ -493,9 +492,7 @@ pg_check_fipsmode(PG_FUNCTION_ARGS) } static void * -find_provider(text *name, - PFN provider_lookup, - const char *desc, int silent) +find_provider(text *name, PFN provider_lookup, int silent) { void *res; char *buf; diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c index 3e47b9364ab3..7eef644e8c35 100644 --- a/contrib/pgcrypto/pgp-pgsql.c +++ b/contrib/pgcrypto/pgp-pgsql.c @@ -119,7 +119,7 @@ struct debug_expect }; static void -fill_expect(struct debug_expect *ex, int text_mode) +fill_expect(struct debug_expect *ex) { ex->debug = 0; ex->expect = 0; @@ -353,7 +353,7 @@ init_work(PGP_Context **ctx_p, int is_text, { int err = pgp_init(ctx_p); - fill_expect(ex, is_text); + fill_expect(ex); if (err == 0 && args != NULL) err = parse_args(*ctx_p, (uint8 *) VARDATA_ANY(args), From 3958b61850fa0d8f68b49c9cd2ae24f44c5999cd Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Thu, 27 Nov 2025 07:22:10 +0000 Subject: [PATCH 3/6] Removing unused function parameters in file_fdw A few parameters are not used, let's remove them. --- contrib/file_fdw/file_fdw.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index e9cda3c47d15..8df746c958dd 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -166,8 +166,7 @@ static bool check_selective_binary_conversion(RelOptInfo *baserel, List **columns); static void estimate_size(PlannerInfo *root, RelOptInfo *baserel, FileFdwPlanState *fdw_private); -static void estimate_costs(PlannerInfo *root, RelOptInfo *baserel, - FileFdwPlanState *fdw_private, +static void estimate_costs(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, @@ -569,8 +568,7 @@ fileGetForeignPaths(PlannerInfo *root, (Node *) columns, -1)); /* Estimate costs */ - estimate_costs(root, baserel, fdw_private, - &startup_cost, &total_cost); + estimate_costs(baserel, fdw_private, &startup_cost, &total_cost); /* * Create a ForeignPath node and add it as only possible path. We use the @@ -1139,7 +1137,7 @@ estimate_size(PlannerInfo *root, RelOptInfo *baserel, * Results are returned in *startup_cost and *total_cost. */ static void -estimate_costs(PlannerInfo *root, RelOptInfo *baserel, +estimate_costs(RelOptInfo *baserel, FileFdwPlanState *fdw_private, Cost *startup_cost, Cost *total_cost) { From be200931e0f0def229305b79eb7a4275a7604c39 Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Thu, 27 Nov 2025 07:35:29 +0000 Subject: [PATCH 4/6] Removing unused function parameters in postgres_fdw A few parameters are not used, let's remove them. Unused rte parameter in create_foreign_modify() is oversight in commit a61b1f74823. --- contrib/postgres_fdw/postgres_fdw.c | 59 +++++++++-------------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 5e178c21b390..f135335bbe62 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -444,7 +444,6 @@ static void adjust_foreign_grouping_path_cost(PlannerInfo *root, double retrieved_rows, double width, double limit_tuples, - int *p_disabled_nodes, Cost *p_startup_cost, Cost *p_run_cost); static bool ec_member_matches_foreign(PlannerInfo *root, RelOptInfo *rel, @@ -455,7 +454,6 @@ static void fetch_more_data(ForeignScanState *node); static void close_cursor(PGconn *conn, unsigned int cursor_number, PgFdwConnState *conn_state); static PgFdwModifyState *create_foreign_modify(EState *estate, - RangeTblEntry *rte, ResultRelInfo *resultRelInfo, CmdType operation, Plan *subplan, @@ -464,8 +462,7 @@ static PgFdwModifyState *create_foreign_modify(EState *estate, int values_end, bool has_returning, List *retrieved_attrs); -static TupleTableSlot **execute_foreign_modify(EState *estate, - ResultRelInfo *resultRelInfo, +static TupleTableSlot **execute_foreign_modify(ResultRelInfo *resultRelInfo, CmdType operation, TupleTableSlot **slots, TupleTableSlot **planSlots, @@ -1924,7 +1921,6 @@ postgresBeginForeignModify(ModifyTableState *mtstate, bool has_returning; int values_end_len; List *retrieved_attrs; - RangeTblEntry *rte; /* * Do nothing in EXPLAIN (no ANALYZE) case. resultRelInfo->ri_FdwState @@ -1945,21 +1941,12 @@ postgresBeginForeignModify(ModifyTableState *mtstate, retrieved_attrs = (List *) list_nth(fdw_private, FdwModifyPrivateRetrievedAttrs); - /* Find RTE. */ - rte = exec_rt_fetch(resultRelInfo->ri_RangeTableIndex, - mtstate->ps.state); - /* Construct an execution state. */ - fmstate = create_foreign_modify(mtstate->ps.state, - rte, - resultRelInfo, + fmstate = create_foreign_modify(mtstate->ps.state, resultRelInfo, mtstate->operation, - outerPlanState(mtstate)->plan, - query, - target_attrs, - values_end_len, - has_returning, - retrieved_attrs); + outerPlanState(mtstate)->plan, query, + target_attrs, values_end_len, + has_returning, retrieved_attrs); resultRelInfo->ri_FdwState = fmstate; } @@ -1984,7 +1971,7 @@ postgresExecForeignInsert(EState *estate, */ if (fmstate->aux_fmstate) resultRelInfo->ri_FdwState = fmstate->aux_fmstate; - rslot = execute_foreign_modify(estate, resultRelInfo, CMD_INSERT, + rslot = execute_foreign_modify(resultRelInfo, CMD_INSERT, &slot, &planSlot, &numSlots); /* Revert that change */ if (fmstate->aux_fmstate) @@ -2013,7 +2000,7 @@ postgresExecForeignBatchInsert(EState *estate, */ if (fmstate->aux_fmstate) resultRelInfo->ri_FdwState = fmstate->aux_fmstate; - rslot = execute_foreign_modify(estate, resultRelInfo, CMD_INSERT, + rslot = execute_foreign_modify(resultRelInfo, CMD_INSERT, slots, planSlots, numSlots); /* Revert that change */ if (fmstate->aux_fmstate) @@ -2106,7 +2093,7 @@ postgresExecForeignUpdate(EState *estate, TupleTableSlot **rslot; int numSlots = 1; - rslot = execute_foreign_modify(estate, resultRelInfo, CMD_UPDATE, + rslot = execute_foreign_modify(resultRelInfo, CMD_UPDATE, &slot, &planSlot, &numSlots); return rslot ? rslot[0] : NULL; @@ -2125,7 +2112,7 @@ postgresExecForeignDelete(EState *estate, TupleTableSlot **rslot; int numSlots = 1; - rslot = execute_foreign_modify(estate, resultRelInfo, CMD_DELETE, + rslot = execute_foreign_modify(resultRelInfo, CMD_DELETE, &slot, &planSlot, &numSlots); return rslot ? rslot[0] : NULL; @@ -2254,14 +2241,9 @@ postgresBeginForeignInsert(ModifyTableState *mtstate, &retrieved_attrs, &values_end_len); /* Construct an execution state. */ - fmstate = create_foreign_modify(mtstate->ps.state, - rte, - resultRelInfo, - CMD_INSERT, - NULL, - sql.data, - targetAttrs, - values_end_len, + fmstate = create_foreign_modify(mtstate->ps.state, resultRelInfo, + CMD_INSERT, NULL, sql.data, + targetAttrs, values_end_len, retrieved_attrs != NIL, retrieved_attrs); @@ -2385,10 +2367,7 @@ postgresRecheckForeignScan(ForeignScanState *node, TupleTableSlot *slot) * error condition, we just abandon trying to do the update directly. */ static ForeignScan * -find_modifytable_subplan(PlannerInfo *root, - ModifyTable *plan, - Index rtindex, - int subplan_index) +find_modifytable_subplan(ModifyTable *plan, Index rtindex, int subplan_index) { Plan *subplan = outerPlan(plan); @@ -2477,7 +2456,7 @@ postgresPlanDirectModify(PlannerInfo *root, /* * Try to locate the ForeignScan subplan that's scanning resultRelation. */ - fscan = find_modifytable_subplan(root, plan, resultRelation, subplan_index); + fscan = find_modifytable_subplan(plan, resultRelation, subplan_index); if (!fscan) return false; @@ -3495,7 +3474,6 @@ estimate_path_cost_size(PlannerInfo *root, adjust_foreign_grouping_path_cost(root, pathkeys, retrieved_rows, width, fpextra->limit_tuples, - &disabled_nodes, &startup_cost, &run_cost); } else @@ -3642,7 +3620,6 @@ adjust_foreign_grouping_path_cost(PlannerInfo *root, double retrieved_rows, double width, double limit_tuples, - int *p_disabled_nodes, Cost *p_startup_cost, Cost *p_run_cost) { @@ -3955,7 +3932,6 @@ close_cursor(PGconn *conn, unsigned int cursor_number, */ static PgFdwModifyState * create_foreign_modify(EState *estate, - RangeTblEntry *rte, ResultRelInfo *resultRelInfo, CmdType operation, Plan *subplan, @@ -4074,8 +4050,7 @@ create_foreign_modify(EState *estate, * postgresExecForeignDelete.) */ static TupleTableSlot ** -execute_foreign_modify(EState *estate, - ResultRelInfo *resultRelInfo, +execute_foreign_modify(ResultRelInfo *resultRelInfo, CmdType operation, TupleTableSlot **slots, TupleTableSlot **planSlots, @@ -5657,7 +5632,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid) * outer rel. */ static bool -semijoin_target_ok(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel) +semijoin_target_ok(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel) { List *vars; ListCell *lc; @@ -5719,7 +5694,7 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, /* * We can't push down semi-join if its reltarget is not safe */ - if ((jointype == JOIN_SEMI) && !semijoin_target_ok(root, joinrel, outerrel, innerrel)) + if ((jointype == JOIN_SEMI) && !semijoin_target_ok(joinrel, outerrel, innerrel)) return false; /* From ec4c4ba3c4d5253638df5b15c399008d44d634da Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Thu, 27 Nov 2025 14:05:25 +0000 Subject: [PATCH 5/6] Removing unused function parameters in citext A few parameters are not used, let's remove them. --- contrib/citext/citext.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/citext/citext.c b/contrib/citext/citext.c index a15ce5db8295..23a242dca82c 100644 --- a/contrib/citext/citext.c +++ b/contrib/citext/citext.c @@ -22,7 +22,7 @@ PG_MODULE_MAGIC_EXT( */ static int32 citextcmp(text *left, text *right, Oid collid); -static int32 internal_citext_pattern_cmp(text *left, text *right, Oid collid); +static int32 internal_citext_pattern_cmp(text *left, text *right); /* * ================= @@ -69,7 +69,7 @@ citextcmp(text *left, text *right, Oid collid) * Returns int32 negative, zero, or positive. */ static int32 -internal_citext_pattern_cmp(text *left, text *right, Oid collid) +internal_citext_pattern_cmp(text *left, text *right) { char *lcstr, *rcstr; @@ -130,7 +130,7 @@ citext_pattern_cmp(PG_FUNCTION_ARGS) text *right = PG_GETARG_TEXT_PP(1); int32 result; - result = internal_citext_pattern_cmp(left, right, PG_GET_COLLATION()); + result = internal_citext_pattern_cmp(left, right); PG_FREE_IF_COPY(left, 0); PG_FREE_IF_COPY(right, 1); @@ -320,7 +320,7 @@ citext_pattern_lt(PG_FUNCTION_ARGS) text *right = PG_GETARG_TEXT_PP(1); bool result; - result = internal_citext_pattern_cmp(left, right, PG_GET_COLLATION()) < 0; + result = internal_citext_pattern_cmp(left, right) < 0; PG_FREE_IF_COPY(left, 0); PG_FREE_IF_COPY(right, 1); @@ -337,7 +337,7 @@ citext_pattern_le(PG_FUNCTION_ARGS) text *right = PG_GETARG_TEXT_PP(1); bool result; - result = internal_citext_pattern_cmp(left, right, PG_GET_COLLATION()) <= 0; + result = internal_citext_pattern_cmp(left, right) <= 0; PG_FREE_IF_COPY(left, 0); PG_FREE_IF_COPY(right, 1); @@ -354,7 +354,7 @@ citext_pattern_gt(PG_FUNCTION_ARGS) text *right = PG_GETARG_TEXT_PP(1); bool result; - result = internal_citext_pattern_cmp(left, right, PG_GET_COLLATION()) > 0; + result = internal_citext_pattern_cmp(left, right) > 0; PG_FREE_IF_COPY(left, 0); PG_FREE_IF_COPY(right, 1); @@ -371,7 +371,7 @@ citext_pattern_ge(PG_FUNCTION_ARGS) text *right = PG_GETARG_TEXT_PP(1); bool result; - result = internal_citext_pattern_cmp(left, right, PG_GET_COLLATION()) >= 0; + result = internal_citext_pattern_cmp(left, right) >= 0; PG_FREE_IF_COPY(left, 0); PG_FREE_IF_COPY(right, 1); From af538b96eb1bcaaab94576e1b10d350bd990a59b Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Thu, 27 Nov 2025 11:48:13 +0000 Subject: [PATCH 6/6] Removing unused function parameters in pg_walinspect A few parameters are not used, let's remove them. --- contrib/pg_walinspect/pg_walinspect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c index 6945bac1306d..161c1e668099 100644 --- a/contrib/pg_walinspect/pg_walinspect.c +++ b/contrib/pg_walinspect/pg_walinspect.c @@ -58,7 +58,7 @@ static void FillXLogStatsRow(const char *name, uint64 n, uint64 total_count, uint64 rec_len, uint64 total_rec_len, uint64 fpi_len, uint64 total_fpi_len, uint64 tot_len, uint64 total_len, - Datum *values, bool *nulls, uint32 ncols); + Datum *values, uint32 ncols); static void GetWalStats(FunctionCallInfo fcinfo, XLogRecPtr start_lsn, XLogRecPtr end_lsn, @@ -609,7 +609,7 @@ FillXLogStatsRow(const char *name, uint64 rec_len, uint64 total_rec_len, uint64 fpi_len, uint64 total_fpi_len, uint64 tot_len, uint64 total_len, - Datum *values, bool *nulls, uint32 ncols) + Datum *values, uint32 ncols) { double n_pct, rec_len_pct, @@ -724,7 +724,7 @@ GetXLogSummaryStats(XLogStats *stats, ReturnSetInfo *rsinfo, FillXLogStatsRow(psprintf("%s/%s", desc.rm_name, id), count, total_count, rec_len, total_rec_len, fpi_len, total_fpi_len, tot_len, total_len, - values, nulls, ncols); + values, ncols); tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls); @@ -745,7 +745,7 @@ GetXLogSummaryStats(XLogStats *stats, ReturnSetInfo *rsinfo, FillXLogStatsRow(desc.rm_name, count, total_count, rec_len, total_rec_len, fpi_len, total_fpi_len, tot_len, - total_len, values, nulls, ncols); + total_len, values, ncols); tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);