Wolfgang Drotschmann <[EMAIL PROTECTED]> writes: > Now, imagine you know the name of a constraint or all of them for a given > table, e.g. destilled via > SELECT * > FROM information_schema.table_constraints > WHERE table_name = '<table_name>'; > How can I get the comment for each of these constraints?
Something like this... regression=# alter table foo add constraint bar check(id > 0); ALTER TABLE regression=# comment on constraint bar on foo is 'check its positive'; COMMENT regression=# select obj_description(oid, 'pg_constraint') from pg_constraint where conname = 'bar' and conrelid = 'foo'::regclass; obj_description -------------------- check its positive (1 row) You could join to pg_description explicitly instead of using obj_description(), and/or join to pg_class instead of using regclass. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly