getTypeDisplayString now better handles zero oid's and oid's that are not known in the catalog.

Close #10
This commit is contained in:
eelke 2018-04-21 10:23:28 +02:00
parent 51d72c7f20
commit 65c3d9f2b4

View file

@ -75,8 +75,15 @@ QString getTablespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid)
QString getTypeDisplayString(const PgDatabaseCatalog &cat, Oid oid, int32_t typmod) QString getTypeDisplayString(const PgDatabaseCatalog &cat, Oid oid, int32_t typmod)
{ {
if (oid == 0) {
return QString();
}
auto tc = cat.types(); auto tc = cat.types();
auto t = tc->getByKey(oid); auto t = tc->getByKey(oid);
if (t.oid == InvalidOid) {
return "(invalid/unknown)";
}
QString s; QString s;
if (t.category == TypCategory::Array) { if (t.category == TypCategory::Array) {
// auto et = tc->getByKey(t.elem); // auto et = tc->getByKey(t.elem);