Skip to content

Commit 5e2af60

Browse files
committed
getObjectDescription: support extended statistics
This was missed in 7b504eb. 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
1 parent 50ee1c7 commit 5e2af60

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/backend/catalog/objectaddress.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,6 +3004,26 @@ getObjectDescription(const ObjectAddress *object)
30043004
break;
30053005
}
30063006

3007+
case OCLASS_STATISTIC_EXT:
3008+
{
3009+
HeapTuple stxTup;
3010+
Form_pg_statistic_ext stxForm;
3011+
3012+
stxTup = SearchSysCache1(STATEXTOID,
3013+
ObjectIdGetDatum(object->objectId));
3014+
if (!HeapTupleIsValid(stxTup))
3015+
elog(ERROR, "could not find tuple for statistics object %u",
3016+
object->objectId);
3017+
3018+
stxForm = (Form_pg_statistic_ext) GETSTRUCT(stxTup);
3019+
3020+
appendStringInfo(&buffer, _("statistics object %s"),
3021+
NameStr(stxForm->stxname));
3022+
3023+
ReleaseSysCache(stxTup);
3024+
break;
3025+
}
3026+
30073027
case OCLASS_TRANSFORM:
30083028
{
30093029
HeapTuple trfTup;
@@ -3394,13 +3414,6 @@ getObjectDescription(const ObjectAddress *object)
33943414
get_subscription_name(object->objectId));
33953415
break;
33963416
}
3397-
3398-
default:
3399-
appendStringInfo(&buffer, "unrecognized object %u %u %d",
3400-
object->classId,
3401-
object->objectId,
3402-
object->objectSubId);
3403-
break;
34043417
}
34053418

34063419
return buffer.data;

0 commit comments

Comments
 (0)