getting comment about constraint

From: canfieldsteve(at)hotmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: getting comment about constraint
Date: 2006-06-18 22:02:05
Message-ID: 1150668125.327100.277760@u72g2000cwu.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How do you retrieve a comment on a constraint? For example, consider
the following table and comment:

create table people (
person_id serial primary key,
uid varchar(25) not null,
constraint uid_alphanumeric check (uid ~ '^[a-z0-9_]+$')
);

comment on constraint uid_alphanumeric on people
is 'UID may only contain letters, numerals, and underscores';

That code code creates a constraint within the "people" table named
"uid_alphanumeric". Furthermore, it creates a comment on that
constraint.

Given the name of the table and constraint, how would you retrieve the
comment? "Chapter 9. Functions and Operators" says that
obj_description(object_oid, catalog_name) returns a comment given the
object's OID and class name. How do I get the OID for the constraint?
It doesn't seem to be stored in pg_constraint.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Qingqing Zhou 2006-06-19 02:42:02 Re: Out of memory error in 8.1.0 Win32
Previous Message Florian G. Pflug 2006-06-18 21:01:01 Re: Changing array subscripting to zero-offset