33 *
44 * Copyright 2000 by PostgreSQL Global Development Group
55 *
6- * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.34 2001/06/30 17:26:11 petere Exp $
6+ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.35 2001/07/08 14:42:17 petere Exp $
77 */
88#include "postgres_fe.h"
99#include "describe.h"
@@ -642,7 +642,7 @@ describeTableDetails(const char *name, bool desc)
642642 {
643643 PGresult * result ;
644644
645- sprintf (buf , "SELECT i.indisunique, i.indisprimary, a.amname\n"
645+ sprintf (buf , "SELECT i.indisunique, i.indisprimary, i.indislossy, a.amname\n"
646646 "FROM pg_index i, pg_class c, pg_am a\n"
647647 "WHERE i.indexrelid = c.oid AND c.relname = '%s' AND c.relam = a.oid" ,
648648 name );
@@ -652,14 +652,18 @@ describeTableDetails(const char *name, bool desc)
652652 error = true;
653653 else
654654 {
655+ /* XXX This construction is poorly internationalized. */
655656 footers = xmalloc (2 * sizeof (* footers ));
656- footers [0 ] = xmalloc (NAMEDATALEN + 32 );
657- sprintf (footers [0 ], "%s%s" ,
658- strcmp (PQgetvalue (result , 0 , 0 ), "t" ) == 0 ? "unique " : "" ,
659- PQgetvalue (result , 0 , 2 )
657+ footers [0 ] = xmalloc (NAMEDATALEN + 128 );
658+ snprintf (footers [0 ], NAMEDATALEN + 128 , "%s%s%s" ,
659+ strcmp (PQgetvalue (result , 0 , 0 ), "t" ) == 0 ? _ ("unique " ) : "" ,
660+ PQgetvalue (result , 0 , 3 ),
661+ strcmp (PQgetvalue (result , 0 , 2 ), "t" ) == 0 ? _ (" (lossy)" ) : ""
660662 );
661663 if (strcmp (PQgetvalue (result , 0 , 1 ), "t" ) == 0 )
662- strcat (footers [0 ], " (primary key)" );
664+ snprintf (footers [0 ] + strlen (footers [0 ]),
665+ NAMEDATALEN + 128 - strlen (footers [0 ]),
666+ _ (" (primary key)" ));
663667 footers [1 ] = NULL ;
664668 }
665669 }
0 commit comments