Commit 082e1c7b authored by Peter Eisentraut's avatar Peter Eisentraut

Show islossy for index.

parent b054fb3b
...@@ -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.34 2001/06/30 17:26:11 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.35 2001/07/08 14:42:17 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "describe.h" #include "describe.h"
...@@ -642,7 +642,7 @@ describeTableDetails(const char *name, bool desc) ...@@ -642,7 +642,7 @@ describeTableDetails(const char *name, bool desc)
{ {
PGresult *result; PGresult *result;
sprintf(buf, "SELECT i.indisunique, i.indisprimary, a.amname\n" sprintf(buf, "SELECT i.indisunique, i.indisprimary, i.indislossy, a.amname\n"
"FROM pg_index i, pg_class c, pg_am a\n" "FROM pg_index i, pg_class c, pg_am a\n"
"WHERE i.indexrelid = c.oid AND c.relname = '%s' AND c.relam = a.oid", "WHERE i.indexrelid = c.oid AND c.relname = '%s' AND c.relam = a.oid",
name); name);
...@@ -652,14 +652,18 @@ describeTableDetails(const char *name, bool desc) ...@@ -652,14 +652,18 @@ describeTableDetails(const char *name, bool desc)
error = true; error = true;
else else
{ {
/* XXX This construction is poorly internationalized. */
footers = xmalloc(2 * sizeof(*footers)); footers = xmalloc(2 * sizeof(*footers));
footers[0] = xmalloc(NAMEDATALEN + 32); footers[0] = xmalloc(NAMEDATALEN + 128);
sprintf(footers[0], "%s%s", snprintf(footers[0], NAMEDATALEN + 128, "%s%s%s",
strcmp(PQgetvalue(result, 0, 0), "t") == 0 ? "unique " : "", strcmp(PQgetvalue(result, 0, 0), "t") == 0 ? _("unique ") : "",
PQgetvalue(result, 0, 2) PQgetvalue(result, 0, 3),
strcmp(PQgetvalue(result, 0, 2), "t") == 0 ? _(" (lossy)") : ""
); );
if (strcmp(PQgetvalue(result, 0, 1), "t") == 0) if (strcmp(PQgetvalue(result, 0, 1), "t") == 0)
strcat(footers[0], " (primary key)"); snprintf(footers[0] + strlen(footers[0]),
NAMEDATALEN + 128 - strlen(footers[0]),
_(" (primary key)"));
footers[1] = NULL; footers[1] = NULL;
} }
} }
......
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