Re: Where can I find detail information about constraint ?

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: <sheepjxx(at)gmail(dot)com>, "Postgres General Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Where can I find detail information about constraint ?
Date: 2009-09-23 13:35:01
Message-ID: D960CB61B694CF459DCFB4B0128514C203937F34@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

??? wrote:
> I want detail usage introduction about constraint,such as how
> to constrain a string to be exactly 4 character and start with 'z'.
> Where can I find the reference of CHECK? detail usage.

Documentation:
http://www.postgresql.org/docs/current/static/ddl-constraints.html#AEN2254

The check you want would look similar to this:
CHECK (length(val) = 4 AND substr(val, 1, 1) = 'z')

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-09-23 13:58:06 Re: How to have ant's <sql> task insert special chars appropriately?
Previous Message Emi Lu 2009-09-23 13:34:32 Re: Graphical representation of query plans