@@ -2647,8 +2647,10 @@ listLanguages(const char *pattern, bool verbose, bool showSystem)
2647
2647
gettext_noop ("Owner" ));
2648
2648
2649
2649
appendPQExpBuffer (& buf ,
2650
- " l.lanpltrusted AS \"%s\"" ,
2651
- gettext_noop ("Trusted" ));
2650
+ " l.lanpltrusted AS \"%s\",\n"
2651
+ " d.description AS \"%s\"" ,
2652
+ gettext_noop ("Trusted" ),
2653
+ gettext_noop ("Description" ));
2652
2654
2653
2655
if (verbose )
2654
2656
{
@@ -2666,13 +2668,18 @@ listLanguages(const char *pattern, bool verbose, bool showSystem)
2666
2668
}
2667
2669
2668
2670
appendPQExpBuffer (& buf ,
2669
- "\nFROM pg_catalog.pg_language l\n" );
2671
+ "\nFROM pg_catalog.pg_language l\n"
2672
+ "LEFT JOIN pg_catalog.pg_description d\n"
2673
+ " ON d.classoid = l.tableoid AND d.objoid = l.oid\n"
2674
+ " AND d.objsubid = 0\n" );
2670
2675
2671
- processSQLNamePattern (pset .db , & buf , pattern , false, false,
2672
- NULL , "l.lanname" , NULL , NULL );
2676
+ if (pattern )
2677
+ processSQLNamePattern (pset .db , & buf , pattern , false, false,
2678
+ NULL , "l.lanname" , NULL , NULL );
2673
2679
2674
2680
if (!showSystem && !pattern )
2675
- appendPQExpBuffer (& buf , "WHERE lanplcallfoid != 0\n" );
2681
+ appendPQExpBuffer (& buf , "WHERE l.lanplcallfoid != 0\n" );
2682
+
2676
2683
2677
2684
appendPQExpBuffer (& buf , "ORDER BY 1;" );
2678
2685
@@ -2820,7 +2827,7 @@ listConversions(const char *pattern, bool showSystem)
2820
2827
* Describes casts.
2821
2828
*/
2822
2829
bool
2823
- listCasts (const char * pattern )
2830
+ listCasts (const char * pattern , bool verbose )
2824
2831
{
2825
2832
PQExpBufferData buf ;
2826
2833
PGresult * res ;
@@ -2844,7 +2851,21 @@ listCasts(const char *pattern)
2844
2851
" CASE WHEN c.castcontext = 'e' THEN '%s'\n"
2845
2852
" WHEN c.castcontext = 'a' THEN '%s'\n"
2846
2853
" ELSE '%s'\n"
2847
- " END as \"%s\"\n"
2854
+ " END as \"%s\"" ,
2855
+ gettext_noop ("Source type" ),
2856
+ gettext_noop ("Target type" ),
2857
+ gettext_noop ("Function" ),
2858
+ gettext_noop ("no" ),
2859
+ gettext_noop ("in assignment" ),
2860
+ gettext_noop ("yes" ),
2861
+ gettext_noop ("Implicit?" ));
2862
+
2863
+ if (verbose )
2864
+ appendPQExpBuffer (& buf ,
2865
+ ",\n d.description AS \"%s\"\n" ,
2866
+ gettext_noop ("Description" ));
2867
+
2868
+ appendPQExpBuffer (& buf ,
2848
2869
"FROM pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p\n"
2849
2870
" ON c.castfunc = p.oid\n"
2850
2871
" LEFT JOIN pg_catalog.pg_type ts\n"
@@ -2854,13 +2875,15 @@ listCasts(const char *pattern)
2854
2875
" LEFT JOIN pg_catalog.pg_type tt\n"
2855
2876
" ON c.casttarget = tt.oid\n"
2856
2877
" LEFT JOIN pg_catalog.pg_namespace nt\n"
2857
- " ON nt.oid = tt.typnamespace\n"
2858
- "WHERE (true" ,
2859
- gettext_noop ("Source type" ),
2860
- gettext_noop ("Target type" ),
2861
- gettext_noop ("Function" ),
2862
- gettext_noop ("no" ), gettext_noop ("in assignment" ), gettext_noop ("yes" ),
2863
- gettext_noop ("Implicit?" ));
2878
+ " ON nt.oid = tt.typnamespace\n" );
2879
+
2880
+ if (verbose )
2881
+ appendPQExpBuffer (& buf ,
2882
+ " LEFT JOIN pg_catalog.pg_description d\n"
2883
+ " ON d.classoid = c.tableoid AND d.objoid = "
2884
+ "c.oid AND d.objsubid = 0\n" );
2885
+
2886
+ appendPQExpBuffer (& buf , "WHERE ( (true" );
2864
2887
2865
2888
/*
2866
2889
* Match name pattern against either internal or external name of either
@@ -2878,7 +2901,7 @@ listCasts(const char *pattern)
2878
2901
"pg_catalog.format_type(tt.oid, NULL)" ,
2879
2902
"pg_catalog.pg_type_is_visible(tt.oid)" );
2880
2903
2881
- appendPQExpBuffer (& buf , ")\nORDER BY 1, 2;" );
2904
+ appendPQExpBuffer (& buf , ") ) \nORDER BY 1, 2;" );
2882
2905
2883
2906
res = PSQLexec (buf .data , false);
2884
2907
termPQExpBuffer (& buf );
0 commit comments