Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see the comment on a PostgreSQL constraint?

Tags:

postgresql

PostgreSQL has a syntax to COMMENT on a constraint:

COMMENT ON CONSTRAINT` constraint_name ON table_name IS 'text'`

Example:

COMMENT ON CONSTRAINT bar_col_cons ON bar IS 'Constrains column col';

That tells me how to define comments on constraints. But how do I then see the comments that have been defined?

The output of \d+ on the table includes a list of constraints, but it doesn't show the comments.

like image 739
Chris Martin Avatar asked Nov 18 '25 11:11

Chris Martin


1 Answers

\dd <constraint_name> should show the comment, but does not filter on table name.

like image 122
Uku Loskit Avatar answered Nov 21 '25 05:11

Uku Loskit