Re: limitations of constraints, possible bugs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: craigp <craigp98072(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: limitations of constraints, possible bugs
Date: 2006-08-16 14:11:20
Message-ID: 13898.1155737480@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

craigp <craigp98072(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric 2006-08-16 14:17:32 Troubles linking with libpqxx
Previous Message Harald Armin Massa 2006-08-16 14:07:10 Re: Is it possible (postgresql/mysql)