Skip site navigation (1) Skip section navigation (2)

Re: CHECK-Constraint mit WHERE ?

From: Martin Spott <Martin(dot)Spott(at)mgras(dot)net>
To: pgsql-de-allgemein(at)postgresql(dot)org
Subject: Re: CHECK-Constraint mit WHERE ?
Date: 2006-06-22 13:57:53
Message-ID: e7e7l1$18em$1@osprey.mgras.de (view raw or flat)
Thread:
Lists: pgsql-de-allgemein
Tobias Bußmann wrote:

> CONSTRAINT enforce_covertype CHECK ((geomtype LIKE 'POLYGON%') AND
> (covertype >= 0 AND covertype < 6)) OR NOT (geomtype LIKE 'POLYGON%')

Fast!, die Klammerung hat 'nen Fehler, den der komplette Ausdruck
hinter dem CHECK muss geklammert werden, die LIKE-Ausdruecke kommen
hingegen auch ohne Klammer aus:

  CONSTRAINT enforce_covertype CHECK (
    (geomtype LIKE 'POLYGON%' AND (covertype >= 0 AND covertype < 6))
    OR geomtype NOT LIKE 'POLYGON%'
  )

.... funktioniert,
	Martin.
-- 
 Unix _IS_ user friendly - it's just selective about who its friends are !
--------------------------------------------------------------------------

In response to

Responses

pgsql-de-allgemein by date

Next:From: Martin SpottDate: 2006-06-22 14:00:26
Subject: Re: Materialized Views
Previous:From: Martin SpottDate: 2006-06-22 13:41:27
Subject: Re: CHECK-Constraint mit WHERE ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group