Postgresql – Show DOMAIN details

domainpostgresql

Showing the columns and constrains of a table in PostgreSQL is done with:

\d+ <table_name>

Which lists the columns, data types and modifiers for a table.

How can I show the details and constraints of Posgresql domain?

Best Answer

To view all domains in your database, run in psql

\dD[S+] [PATTERN]      list domains

You can see the list of all psql commands with \?.

pg_constraint stores check, primary key, unique, foreign key, and exclusion constraints on tables. Column constraints are not treated specially. Every column constraint is equivalent to some table constraint. Not-null constraints are represented in the pg_attribute catalog, not here.