aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/describe.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 43285676857..eb547103dea 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2083,9 +2083,8 @@ describeOneTableDetails(const char *schemaname,
partconstraintdef);
printTableAddFooter(&cont, tmpbuf.data);
}
-
- PQclear(result);
}
+ PQclear(result);
}
if (tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
@@ -2098,12 +2097,15 @@ describeOneTableDetails(const char *schemaname,
"SELECT pg_catalog.pg_get_partkeydef('%s'::pg_catalog.oid);",
oid);
result = PSQLexec(buf.data);
- if (!result || PQntuples(result) != 1)
+ if (!result)
goto error_return;
- partkeydef = PQgetvalue(result, 0, 0);
- printfPQExpBuffer(&tmpbuf, _("Partition key: %s"), partkeydef);
- printTableAddFooter(&cont, tmpbuf.data);
+ if (PQntuples(result) == 1)
+ {
+ partkeydef = PQgetvalue(result, 0, 0);
+ printfPQExpBuffer(&tmpbuf, _("Partition key: %s"), partkeydef);
+ printTableAddFooter(&cont, tmpbuf.data);
+ }
PQclear(result);
}