Re: CHECK-Constraint mit WHERE ?

From: Christoph Lamprecht <christoph(dot)lamprecht(at)web(dot)de>
To: pgsql-de-allgemein(at)postgresql(dot)org
Subject: Re: CHECK-Constraint mit WHERE ?
Date: 2006-06-22 22:03:27
Message-ID: 1334873876@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-de-allgemein


Martin Spott <Martin(dot)Spott(at)mgras(dot)net> schrieb am 22.06.2006 15:58:26:
>
> 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.
> --

Hallo,
geht das nicht einfacher:

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

??
Christoph
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000071

Responses

Browse pgsql-de-allgemein by date

  From Date Subject
Next Message Martin Spott 2006-06-22 22:52:51 Re: CHECK-Constraint mit WHERE ?
Previous Message Andreas Bauer 2006-06-22 21:36:46 Problem mit Starten des "PostgreSQL Database Server 8.1" Dienstes