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