Skip to content

Commit 09a7cd4

Browse files
committed
Rename postgres_fdw's use_remote_explain option to use_remote_estimate.
The new name was originally my typo, but per discussion it seems like a better name anyway. So make the code match the docs, not vice versa.
1 parent 8e8d0f7 commit 09a7cd4

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ALTER FOREIGN TABLE ft2 DROP COLUMN c0;
7878
-- requiressl, krbsrvname and gsslib are omitted because they depend on
7979
-- configure options
8080
ALTER SERVER testserver1 OPTIONS (
81-
use_remote_explain 'false',
81+
use_remote_estimate 'false',
8282
fdw_startup_cost '123.456',
8383
fdw_tuple_cost '0.123',
8484
service 'value',
@@ -121,9 +121,9 @@ ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
121121

122122
-- Now we should be able to run ANALYZE.
123123
-- To exercise multiple code paths, we use local stats on ft1
124-
-- and remote_explain mode on ft2.
124+
-- and remote-estimate mode on ft2.
125125
ANALYZE ft1;
126-
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_explain 'true');
126+
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_estimate 'true');
127127
-- ===================================================================
128128
-- simple queries
129129
-- ===================================================================

contrib/postgres_fdw/option.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
106106
/*
107107
* Validate option value, when we can do so without any context.
108108
*/
109-
if (strcmp(def->defname, "use_remote_explain") == 0)
109+
if (strcmp(def->defname, "use_remote_estimate") == 0)
110110
{
111-
/* use_remote_explain accepts only boolean values */
111+
/* use_remote_estimate accepts only boolean values */
112112
(void) defGetBoolean(def);
113113
}
114114
else if (strcmp(def->defname, "fdw_startup_cost") == 0 ||
@@ -145,9 +145,9 @@ InitPgFdwOptions(void)
145145
{"schema_name", ForeignTableRelationId, false},
146146
{"table_name", ForeignTableRelationId, false},
147147
{"column_name", AttributeRelationId, false},
148-
/* use_remote_explain is available on both server and table */
149-
{"use_remote_explain", ForeignServerRelationId, false},
150-
{"use_remote_explain", ForeignTableRelationId, false},
148+
/* use_remote_estimate is available on both server and table */
149+
{"use_remote_estimate", ForeignServerRelationId, false},
150+
{"use_remote_estimate", ForeignTableRelationId, false},
151151
/* cost factors */
152152
{"fdw_startup_cost", ForeignServerRelationId, false},
153153
{"fdw_tuple_cost", ForeignServerRelationId, false},

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
248248
RelOptInfo *baserel,
249249
Oid foreigntableid)
250250
{
251-
bool use_remote_explain = false;
251+
bool use_remote_estimate = false;
252252
ListCell *lc;
253253
PgFdwRelationInfo *fpinfo;
254254
StringInfo sql;
@@ -285,19 +285,19 @@ postgresGetForeignRelSize(PlannerInfo *root,
285285
{
286286
DefElem *def = (DefElem *) lfirst(lc);
287287

288-
if (strcmp(def->defname, "use_remote_explain") == 0)
288+
if (strcmp(def->defname, "use_remote_estimate") == 0)
289289
{
290-
use_remote_explain = defGetBoolean(def);
290+
use_remote_estimate = defGetBoolean(def);
291291
break;
292292
}
293293
}
294294
foreach(lc, table->options)
295295
{
296296
DefElem *def = (DefElem *) lfirst(lc);
297297

298-
if (strcmp(def->defname, "use_remote_explain") == 0)
298+
if (strcmp(def->defname, "use_remote_estimate") == 0)
299299
{
300-
use_remote_explain = defGetBoolean(def);
300+
use_remote_estimate = defGetBoolean(def);
301301
break;
302302
}
303303
}
@@ -315,12 +315,12 @@ postgresGetForeignRelSize(PlannerInfo *root,
315315
appendWhereClause(sql, true, remote_conds, root);
316316

317317
/*
318-
* If the table or the server is configured to use remote EXPLAIN, connect
319-
* to the foreign server and execute EXPLAIN with the quals that don't
320-
* contain any Param nodes. Otherwise, estimate rows using whatever
318+
* If the table or the server is configured to use remote estimates,
319+
* connect to the foreign server and execute EXPLAIN with the quals that
320+
* don't contain any Param nodes. Otherwise, estimate rows using whatever
321321
* statistics we have locally, in a way similar to ordinary tables.
322322
*/
323-
if (use_remote_explain)
323+
if (use_remote_estimate)
324324
{
325325
RangeTblEntry *rte;
326326
Oid userid;

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ ALTER FOREIGN TABLE ft2 DROP COLUMN c0;
8787
-- requiressl, krbsrvname and gsslib are omitted because they depend on
8888
-- configure options
8989
ALTER SERVER testserver1 OPTIONS (
90-
use_remote_explain 'false',
90+
use_remote_estimate 'false',
9191
fdw_startup_cost '123.456',
9292
fdw_tuple_cost '0.123',
9393
service 'value',
@@ -124,9 +124,9 @@ ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
124124

125125
-- Now we should be able to run ANALYZE.
126126
-- To exercise multiple code paths, we use local stats on ft1
127-
-- and remote_explain mode on ft2.
127+
-- and remote-estimate mode on ft2.
128128
ANALYZE ft1;
129-
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_explain 'true');
129+
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_estimate 'true');
130130

131131
-- ===================================================================
132132
-- simple queries

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy