diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index ab12614..736907e 100644 *** a/doc/src/sgml/ref/comment.sgml --- b/doc/src/sgml/ref/comment.sgml *************** COMMENT ON *** 26,32 **** AGGREGATE agg_name (agg_type [, ...] ) | CAST (source_type AS target_type) | COLLATION object_name | ! COLUMN table_name.column_name | CONSTRAINT constraint_name ON table_name | CONVERSION object_name | DATABASE object_name | --- 26,32 ---- AGGREGATE agg_name (agg_type [, ...] ) | CAST (source_type AS target_type) | COLLATION object_name | ! COLUMN relation_name.column_name | CONSTRAINT constraint_name ON table_name | CONVERSION object_name | DATABASE object_name | *************** COMMENT ON *** 97,105 **** - object_name - table_name.column_name agg_name constraint_name function_name operator_name --- 97,104 ---- agg_name + object_name constraint_name function_name operator_name *************** COMMENT ON *** 143,148 **** --- 142,158 ---- + + + relation_name.column_name + + + For comments on columns, the name of the relation and column. Column + comments may be used with tables, views, composite types, and + foreign tables. + + + argmode diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 682cf8a..dda7097 100644 *** a/src/bin/psql/describe.c --- b/src/bin/psql/describe.c *************** describeOneTableDetails(const char *sche *** 1295,1302 **** appendPQExpBuffer(&buf, "\n NULL AS attcollation"); if (tableinfo.relkind == 'i') appendPQExpBuffer(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef"); ! if (verbose) ! appendPQExpBuffer(&buf, ",\n a.attstorage, pg_catalog.col_description(a.attrelid, a.attnum)"); appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a"); appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0 AND NOT a.attisdropped", oid); appendPQExpBuffer(&buf, "\nORDER BY a.attnum;"); --- 1295,1311 ---- appendPQExpBuffer(&buf, "\n NULL AS attcollation"); if (tableinfo.relkind == 'i') appendPQExpBuffer(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef"); ! if (verbose) { ! appendPQExpBuffer(&buf, ",\n a.attstorage"); ! /* In 9.0+, we have column comments for: relations, views, composite ! * types (not handled here), and foreign tables (c.f. CommentObject() ! * in comment.c). ! */ ! if (tableinfo.relkind == 'r' || tableinfo.relkind == 'v' || ! tableinfo.relkind == 'f' || tableinfo.relkind == 'c') ! appendPQExpBuffer(&buf, ", pg_catalog.col_description(a.attrelid, a.attnum)"); ! } ! appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a"); appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0 AND NOT a.attisdropped", oid); appendPQExpBuffer(&buf, "\nORDER BY a.attnum;"); *************** describeOneTableDetails(const char *sche *** 1379,1385 **** if (verbose) { headers[cols++] = gettext_noop("Storage"); ! headers[cols++] = gettext_noop("Description"); } printTableInit(&cont, &myopt, title.data, cols, numrows); --- 1388,1397 ---- if (verbose) { headers[cols++] = gettext_noop("Storage"); ! /* Column comments, if the relkind supports this feature. */ ! if (tableinfo.relkind == 'r' || tableinfo.relkind == 'v' || ! tableinfo.relkind == 'c' || tableinfo.relkind == 'f') ! headers[cols++] = gettext_noop("Description"); } printTableInit(&cont, &myopt, title.data, cols, numrows); *************** describeOneTableDetails(const char *sche *** 1471,1478 **** (storage[0] == 'e' ? "external" : "???")))), false, false); ! printTableAddCell(&cont, PQgetvalue(res, i, firstvcol + 1), ! false, false); } } --- 1483,1493 ---- (storage[0] == 'e' ? "external" : "???")))), false, false); ! /* Column comments, if the relkind supports this feature. */ ! if (tableinfo.relkind == 'r' || tableinfo.relkind == 'v' || ! tableinfo.relkind == 'c' || tableinfo.relkind == 'f') ! printTableAddCell(&cont, PQgetvalue(res, i, firstvcol + 1), ! false, false); } }