Re: limitations of constraints, possible bugs - Mailing list pgsql-general

From Tom Lane
Subject Re: limitations of constraints, possible bugs
Date
Msg-id 13898.1155737480@sss.pgh.pa.us
Whole thread Raw
In response to limitations of constraints, possible bugs  (craigp <craigp98072@yahoo.com>)
Responses Re: limitations of constraints, possible bugs
List pgsql-general
craigp <craigp98072@yahoo.com> writes:
> for instance, if i create a domain (D) with some constraint, and create a table
> with a column of type D[], will that domain constraint be enforced for each
> element of the array?

Currently we don't support arrays of domain types (this should get fixed
sometime).  If we did, then yeah, that's how it'd work.

> could i create a column constraint on an array to enforce
> some kind of relationship among the elements (say, that they are sorted, or
> that there are no NULL elements if/when NULL elements are supported in arrays),

If you could express it as a SQL boolean expression, then it'd work as a
constraint.  For something like a sortedness check, it'd likely be
easier to check with a loop in a trigger function.

> i have noticed in the docs that there are various limitations in the current
> implementation: domain constraints aren't enforced when returned from
> functions, rowtype (from create table) constraints aren't enforced, constraints
> can't be defined for composite types, etc. i see the first one is on the TODO
> list; what about the others?

The first of these is done in CVS HEAD, the others probably will get
done someday.  If you want to see them happen sooner rather than later,
consider working on 'em yourself ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Harald Armin Massa"
Date:
Subject: Re: Is it possible (postgresql/mysql)
Next
From: Peter Nixonn
Date:
Subject: Weird join result