Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71aab11

Browse files
committed
Missed one NAMEDATALEN.
1 parent3d72629 commit71aab11

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

‎src/bin/psql/describe.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.51 2002/04/2405:24:00 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.52 2002/04/2406:17:04 petere Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"describe.h"
@@ -662,21 +662,31 @@ describeTableDetails(const char *name, bool desc)
662662
}
663663
else
664664
{
665+
PQExpBufferDatatmpbuf;
665666
char*indisunique=PQgetvalue(result,0,0);
666667
char*indisprimary=PQgetvalue(result,0,1);
667668
char*indamname=PQgetvalue(result,0,2);
668669
char*indtable=PQgetvalue(result,0,3);
669670
char*indpred=PQgetvalue(result,0,4);
670671

672+
initPQExpBuffer(&tmpbuf);
673+
674+
if (strcmp(indisprimary,"t")==0)
675+
printfPQExpBuffer(&tmpbuf,_("primary key, "));
676+
elseif (strcmp(indisunique,"t")==0)
677+
printfPQExpBuffer(&tmpbuf,_("unique, "));
678+
else
679+
resetPQExpBuffer(&tmpbuf);
680+
appendPQExpBuffer(&tmpbuf,"%s, ",indamname);
681+
682+
appendPQExpBuffer(&tmpbuf,_("for table \"%s\""),indtable);
683+
if (strlen(indpred))
684+
appendPQExpBuffer(&tmpbuf,", predicate %s",indpred);
685+
671686
footers=xmalloc(2*sizeof(*footers));
672-
/* XXX This construction is poorly internationalized. */
673-
footers[0]=xmalloc(NAMEDATALEN*4+128);
674-
snprintf(footers[0],NAMEDATALEN*4+128,"%s%s for %s \"%s\"%s%s",
675-
strcmp(indisprimary,"t")==0 ?_("primary key ") :
676-
strcmp(indisunique,"t")==0 ?_("unique ") :"",
677-
indamname,_("table"),indtable,
678-
strlen(indpred) ?" WHERE " :"",indpred);
687+
footers[0]=xstrdup(tmpbuf.data);
679688
footers[1]=NULL;
689+
termPQExpBuffer(&tmpbuf);
680690
}
681691

682692
PQclear(result);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp