3
3
*
4
4
* Copyright 2000 by PostgreSQL Global Development Group
5
5
*
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 $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "describe.h"
@@ -642,7 +642,7 @@ describeTableDetails(const char *name, bool desc)
642
642
{
643
643
PGresult * result ;
644
644
645
- sprintf (buf ,"SELECT i.indisunique, i.indisprimary, a.amname\n"
645
+ sprintf (buf ,"SELECT i.indisunique, i.indisprimary,i.indislossy, a.amname\n"
646
646
"FROM pg_index i, pg_class c, pg_am a\n"
647
647
"WHERE i.indexrelid = c.oid AND c.relname = '%s' AND c.relam = a.oid" ,
648
648
name );
@@ -652,14 +652,18 @@ describeTableDetails(const char *name, bool desc)
652
652
error = true;
653
653
else
654
654
{
655
+ /* XXX This construction is poorly internationalized. */
655
656
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)" ) :""
660
662
);
661
663
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)" ));
663
667
footers [1 ]= NULL ;
664
668
}
665
669
}