aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2023-01-06 14:47:02 +0100
committerTomas Vondra <tomas.vondra@postgresql.org>2023-01-06 14:47:23 +0100
commit211d80c065626d1a9188188d78ede85d799b93b1 (patch)
treebcaf1df55002679cd582925f820ce139f060e5b9 /contrib/postgres_fdw/postgres_fdw.c
parent4037c5e2fe9e2c7b083606435d29cdb25092f70f (diff)
downloadpostgresql-211d80c065626d1a9188188d78ede85d799b93b1.tar.gz
postgresql-211d80c065626d1a9188188d78ede85d799b93b1.zip
Fix stale comment about sample_frac adjustment
A comment was left behind referencing sample rate adjustment removed from 8ad51b5f44. So clean that up. While at it also remove the sample rate clamping which should not be necessary without the clamping, and just check that with an assert. Reported-by: Tom Lane Discussion: https://postgr.es/m/951485.1672461744%40sss.pgh.pa.us
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 332b4a5cdeb..f8461bf18dc 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -5204,10 +5204,11 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
sample_frac = targrows / reltuples;
/*
- * Ensure the sampling rate is between 0.0 and 1.0, even after the
- * 10% adjustment above. (Clamping to 0.0 is just paranoia.)
+ * We should never get sampling rate outside the valid range
+ * (between 0.0 and 1.0), because those cases should be covered
+ * by the previous branch that sets ANALYZE_SAMPLE_OFF.
*/
- sample_frac = Min(1.0, Max(0.0, sample_frac));
+ Assert(sample_frac >= 0.0 && sample_frac <= 1.0);
}
}