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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-de-allgemein by date

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