Re: Checking number of entries - Mailing list pgsql-general

From Tom Lane
Subject Re: Checking number of entries
Date
Msg-id 15811.970200250@sss.pgh.pa.us
Whole thread Raw
In response to Re: Checking number of entries  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-general
Philip Warner <pjw@rhyme.com.au> writes:
> Under 7.1 (and with the constraint in the table definition in 7.0.2) and it
> lets me define the table & constraint, but when I insert into the table, I
> get:
>     ERROR:  ExecEvalExpr: unknown expression type 108
> Seems to me it should either disallow the creation, or work properly.

Picky, picky ...

I've added the appropriate checks to AddRelationRawConstraints():

regression=# Alter  TABLE mytable Add
regression-# CHECK ( (Select COUNT(distinct id) From mytable) <= 10);
ERROR:  Cannot use subselect in CHECK clause
regression=# Alter  TABLE mytable Add
regression-# CHECK (  COUNT( id) <= 10);
ERROR:  Cannot use aggregate in CHECK clause

Coming soon to a CVS server near you.

            regards, tom lane

pgsql-general by date:

Previous
From: Philip Warner
Date:
Subject: Re: Checking number of entries
Next
From: Tom Lane
Date:
Subject: Re: Checking number of entries