Mega Code Archive

 
Categories / PostgreSQL / Constraints
 

Assign your own name for a unique constraint

postgres=# -- Assign your own name for a unique constraint postgres=# postgres=# CREATE TABLE products ( postgres(#    product_no integer CONSTRAINT must_be_different UNIQUE, postgres(#    name text, postgres(#    price numeric postgres(# ); NOTICE:  CREATE TABLE / UNIQUE will create implicit index "must_be_different" for table "products" CREATE TABLE postgres=# postgres=# postgres=# drop table products; DROP TABLE postgres=# postgres=#