|
3 | 3 | * |
4 | 4 | * Copyright (c) 2000-2008, PostgreSQL Global Development Group |
5 | 5 | * |
6 | | - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.171 2008/05/12 22:59:58 alvherre Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.172 2008/05/13 00:14:11 alvherre Exp $ |
7 | 7 | */ |
8 | 8 | #include"postgres_fe.h" |
9 | 9 |
|
@@ -865,6 +865,45 @@ describeOneTableDetails(const char *schemaname, |
865 | 865 | gotoerror_return; |
866 | 866 | numrows=PQntuples(res); |
867 | 867 |
|
| 868 | +/* Make title */ |
| 869 | +switch (tableinfo.relkind) |
| 870 | +{ |
| 871 | +case'r': |
| 872 | +printfPQExpBuffer(&title,_("Table \"%s.%s\""), |
| 873 | +schemaname,relationname); |
| 874 | +break; |
| 875 | +case'v': |
| 876 | +printfPQExpBuffer(&title,_("View \"%s.%s\""), |
| 877 | +schemaname,relationname); |
| 878 | +break; |
| 879 | +case'S': |
| 880 | +printfPQExpBuffer(&title,_("Sequence \"%s.%s\""), |
| 881 | +schemaname,relationname); |
| 882 | +break; |
| 883 | +case'i': |
| 884 | +printfPQExpBuffer(&title,_("Index \"%s.%s\""), |
| 885 | +schemaname,relationname); |
| 886 | +break; |
| 887 | +case's': |
| 888 | +/* not used as of 8.2, but keep it for backwards compatibility */ |
| 889 | +printfPQExpBuffer(&title,_("Special relation \"%s.%s\""), |
| 890 | +schemaname,relationname); |
| 891 | +break; |
| 892 | +case't': |
| 893 | +printfPQExpBuffer(&title,_("TOAST table \"%s.%s\""), |
| 894 | +schemaname,relationname); |
| 895 | +break; |
| 896 | +case'c': |
| 897 | +printfPQExpBuffer(&title,_("Composite type \"%s.%s\""), |
| 898 | +schemaname,relationname); |
| 899 | +break; |
| 900 | +default: |
| 901 | +/* untranslated unknown relkind */ |
| 902 | +printfPQExpBuffer(&title,"?%c? \"%s.%s\"", |
| 903 | +tableinfo.relkind,schemaname,relationname); |
| 904 | +break; |
| 905 | +} |
| 906 | + |
868 | 907 | /* Set the number of columns, and their names */ |
869 | 908 | cols=2; |
870 | 909 | headers[0]="Column"; |
@@ -937,45 +976,6 @@ describeOneTableDetails(const char *schemaname, |
937 | 976 | printTableAddCell(&cont,PQgetvalue(res,i,5), false); |
938 | 977 | } |
939 | 978 |
|
940 | | -/* Make title */ |
941 | | -switch (tableinfo.relkind) |
942 | | -{ |
943 | | -case'r': |
944 | | -printfPQExpBuffer(&title,_("Table \"%s.%s\""), |
945 | | -schemaname,relationname); |
946 | | -break; |
947 | | -case'v': |
948 | | -printfPQExpBuffer(&title,_("View \"%s.%s\""), |
949 | | -schemaname,relationname); |
950 | | -break; |
951 | | -case'S': |
952 | | -printfPQExpBuffer(&title,_("Sequence \"%s.%s\""), |
953 | | -schemaname,relationname); |
954 | | -break; |
955 | | -case'i': |
956 | | -printfPQExpBuffer(&title,_("Index \"%s.%s\""), |
957 | | -schemaname,relationname); |
958 | | -break; |
959 | | -case's': |
960 | | -/* not used as of 8.2, but keep it for backwards compatibility */ |
961 | | -printfPQExpBuffer(&title,_("Special relation \"%s.%s\""), |
962 | | -schemaname,relationname); |
963 | | -break; |
964 | | -case't': |
965 | | -printfPQExpBuffer(&title,_("TOAST table \"%s.%s\""), |
966 | | -schemaname,relationname); |
967 | | -break; |
968 | | -case'c': |
969 | | -printfPQExpBuffer(&title,_("Composite type \"%s.%s\""), |
970 | | -schemaname,relationname); |
971 | | -break; |
972 | | -default: |
973 | | -/* untranslated unknown relkind */ |
974 | | -printfPQExpBuffer(&title,"?%c? \"%s.%s\"", |
975 | | -tableinfo.relkind,schemaname,relationname); |
976 | | -break; |
977 | | -} |
978 | | - |
979 | 979 | /* Make footers */ |
980 | 980 | if (tableinfo.relkind=='i') |
981 | 981 | { |
|