Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c0b1b01

Browse files
committed
Show enum values in psql's \dt+. David Fetter.
1 parent b6d1559 commit c0b1b01

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/bin/psql/describe.c

+15-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.168 2008/05/02 10:16:16 heikki Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.169 2008/05/05 00:11:31 adunstan Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -307,11 +307,22 @@ describeTypes(const char *pattern, bool verbose)
307307
" WHEN t.typlen < 0\n"
308308
" THEN CAST('var' AS pg_catalog.text)\n"
309309
" ELSE CAST(t.typlen AS pg_catalog.text)\n"
310-
" END AS \"%s\",\n",
310+
" END AS \"%s\",\n"
311+
" pg_catalog.array_to_string(\n"
312+
" ARRAY(\n"
313+
" SELECT e.enumlabel\n"
314+
" FROM pg_catalog.pg_enum e\n"
315+
" WHERE e.enumtypid = t.oid\n"
316+
" ORDER BY e.oid\n"
317+
" ),\n"
318+
" E'\\n'\n"
319+
" ) AS \"%s\",\n",
311320
gettext_noop("Internal name"),
312-
gettext_noop("Size"));
321+
gettext_noop("Size"),
322+
gettext_noop("Elements"));
323+
313324
appendPQExpBuffer(&buf,
314-
" pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n",
325+
" pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n",
315326
gettext_noop("Description"));
316327

317328
appendPQExpBuffer(&buf, "FROM pg_catalog.pg_type t\n"

0 commit comments

Comments
 (0)