Commit 71aab113 authored by Peter Eisentraut's avatar Peter Eisentraut

Missed one NAMEDATALEN.

parent 3d726290
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.51 2002/04/24 05:24:00 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.52 2002/04/24 06:17:04 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "describe.h" #include "describe.h"
...@@ -662,21 +662,31 @@ describeTableDetails(const char *name, bool desc) ...@@ -662,21 +662,31 @@ describeTableDetails(const char *name, bool desc)
} }
else else
{ {
PQExpBufferData tmpbuf;
char *indisunique = PQgetvalue(result, 0, 0); char *indisunique = PQgetvalue(result, 0, 0);
char *indisprimary = PQgetvalue(result, 0, 1); char *indisprimary = PQgetvalue(result, 0, 1);
char *indamname = PQgetvalue(result, 0, 2); char *indamname = PQgetvalue(result, 0, 2);
char *indtable = PQgetvalue(result, 0, 3); char *indtable = PQgetvalue(result, 0, 3);
char *indpred = PQgetvalue(result, 0, 4); char *indpred = PQgetvalue(result, 0, 4);
initPQExpBuffer(&tmpbuf);
if (strcmp(indisprimary, "t") == 0)
printfPQExpBuffer(&tmpbuf, _("primary key, "));
else if (strcmp(indisunique, "t") == 0)
printfPQExpBuffer(&tmpbuf, _("unique, "));
else
resetPQExpBuffer(&tmpbuf);
appendPQExpBuffer(&tmpbuf, "%s, ", indamname);
appendPQExpBuffer(&tmpbuf, _("for table \"%s\""), indtable);
if (strlen(indpred))
appendPQExpBuffer(&tmpbuf, ", predicate %s", indpred);
footers = xmalloc(2 * sizeof(*footers)); footers = xmalloc(2 * sizeof(*footers));
/* XXX This construction is poorly internationalized. */ footers[0] = xstrdup(tmpbuf.data);
footers[0] = xmalloc(NAMEDATALEN*4 + 128);
snprintf(footers[0], NAMEDATALEN*4 + 128, "%s%s for %s \"%s\"%s%s",
strcmp(indisprimary, "t") == 0 ? _("primary key ") :
strcmp(indisunique, "t") == 0 ? _("unique ") : "",
indamname, _("table"), indtable,
strlen(indpred) ? " WHERE " : "",indpred);
footers[1] = NULL; footers[1] = NULL;
termPQExpBuffer(&tmpbuf);
} }
PQclear(result); PQclear(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment