]> granicus.if.org Git - postgresql/commitdiff
getObjectDescription: support extended statistics
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 12 May 2017 22:22:03 +0000 (19:22 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 12 May 2017 22:22:50 +0000 (19:22 -0300)
This was missed in 7b504eb282ca.

Remove the "default:" clause in the switch, to avoid this problem in the
future.  Other switches involving the same enum should probably be
changed in the same way, but are not touched by this patch.

Discussion: https://postgr.es/m/20170512204800.iqt2uwyx3c32j45r@alvherre.pgsql

src/backend/catalog/objectaddress.c

index a9e529fba0a8d9e72862de4682e27f67a108184d..a373df743b997f424884c199d4e47cfe54c429aa 100644 (file)
@@ -3004,6 +3004,26 @@ getObjectDescription(const ObjectAddress *object)
                                break;
                        }
 
+               case OCLASS_STATISTIC_EXT:
+                       {
+                               HeapTuple       stxTup;
+                               Form_pg_statistic_ext stxForm;
+
+                               stxTup = SearchSysCache1(STATEXTOID,
+                                                                                ObjectIdGetDatum(object->objectId));
+                               if (!HeapTupleIsValid(stxTup))
+                                       elog(ERROR, "could not find tuple for statistics object %u",
+                                                object->objectId);
+
+                               stxForm = (Form_pg_statistic_ext) GETSTRUCT(stxTup);
+
+                               appendStringInfo(&buffer, _("statistics object %s"),
+                                                                NameStr(stxForm->stxname));
+
+                               ReleaseSysCache(stxTup);
+                               break;
+                       }
+
                case OCLASS_TRANSFORM:
                        {
                                HeapTuple       trfTup;
@@ -3394,13 +3414,6 @@ getObjectDescription(const ObjectAddress *object)
                                                                 get_subscription_name(object->objectId));
                                break;
                        }
-
-               default:
-                       appendStringInfo(&buffer, "unrecognized object %u %u %d",
-                                                        object->classId,
-                                                        object->objectId,
-                                                        object->objectSubId);
-                       break;
        }
 
        return buffer.data;