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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: CHECK-Constraint mit WHERE ?



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 !
--------------------------------------------------------------------------



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group