Re: Constraint: string length must be 32 chars

From: Guy Rouillier <guyr-ml1(at)burntmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Constraint: string length must be 32 chars
Date: 2010-10-16 17:15:18
Message-ID: 4CB9DDA6.2050300@burntmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2010-10-16 19:23:44 Re: Constraint: string length must be 32 chars
Previous Message Adrian Klaver 2010-10-16 17:04:39 Re: Fastest way to check database's existence