Teoretically:
CREATE TYPE my_type AS ENUM('foo', 'bar');
CREATE TYPE my_type_description AS ENUM('foo desc', 'bar desc');
CREATE FUNCTION show_desc(i my_type) RETURNS my_type_description AS $sql$
SELECT ((enum_range(NULL::my_type_description))[array_length(enum_range(NULL, i), 1)])::my_type_description;
$sql$ LANGUAGE SQL STABLE;
SELECT show_desc('foo');
show_desc
-----------
foo desc
(1 row)
SELECT show_desc('bar');
show_desc
-----------
bar desc
(1 row)
をいくつかの変態ファンタジーと
t=# \x
Expanded display is on.
t=# comment on type my_type is 'foo: something fooish, bar: a place to avoid';
COMMENT
t=# \dT+ my_type
List of data types
-[ RECORD 1 ]-----+---------------------------------------------
Schema | public
Name | my_type
Internal name | my_type
Size | 4
Elements | foo +
| bar
Owner | postgres
Access privileges |
Description | foo: something fooish, bar: a place to avoid
標準
comment
..?