]> granicus.if.org Git - postgresql/commitdiff
Fix extstat collection when no stats are produced for a column
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 29 Nov 2017 02:25:47 +0000 (23:25 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 29 Nov 2017 02:40:11 +0000 (23:40 -0300)
This is a mistakenly placed conditional in bf2a691e02d7.

Reported by Justin Pryzby
Discussion: https://postgr.es/m/20171117214352.GE25796@telsasoft.com

src/backend/statistics/extended_stats.c

index db4987bde38293257ed527ad4727804f41f7ae6d..eeed56ff0aa4b780bc514cc2a19e89e1d31e3186 100644 (file)
@@ -95,15 +95,16 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
                 */
                stats = lookup_var_attr_stats(onerel, stat->columns,
                                                                          natts, vacattrstats);
-               if (!stats && !IsAutoVacuumWorkerProcess())
+               if (!stats)
                {
-                       ereport(WARNING,
-                                       (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
-                                        errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"",
-                                                       stat->schema, stat->name,
-                                                       get_namespace_name(onerel->rd_rel->relnamespace),
-                                                       RelationGetRelationName(onerel)),
-                                        errtable(onerel)));
+                       if (!IsAutoVacuumWorkerProcess())
+                               ereport(WARNING,
+                                               (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+                                                errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"",
+                                                               stat->schema, stat->name,
+                                                               get_namespace_name(onerel->rd_rel->relnamespace),
+                                                               RelationGetRelationName(onerel)),
+                                                errtable(onerel)));
                        continue;
                }