Re: Constraint: string length must be 32 chars - Mailing list pgsql-general

From Guy Rouillier
Subject Re: Constraint: string length must be 32 chars
Date
Msg-id 4CB9DDA6.2050300@burntmail.com
Whole thread Raw
In response to Re: Constraint: string length must be 32 chars  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general
On 10/16/2010 12:48 PM, Alexander Farber wrote:
> snake=>  create table gps (
> id varchar(32) primary key CONSTRAINT id_length char_length(id)=32,
> stamp timestamp DEFAULT current_timestamp,
> pos point);
> ERROR:  syntax error at or near "char_length"
> LINE 2: id varchar(32) primary key CONSTRAINT id_length char_length(...

> Sorry, any ideas? (I know it's a stupid question)

See the documentation section 5.3.1 Check Constraints.  The condition
needs to be in parentheses.  And in order to name your constraint, you
must use the CONSTRAINT variant.

--
Guy Rouillier

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Fastest way to check database's existence
Next
From: Merlin Moncure
Date:
Subject: Re: Constraint: string length must be 32 chars