Re: named generic constraints [feature request] - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: named generic constraints [feature request]
Date
Msg-id 1259011825.2321.10.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: named generic constraints [feature request]  (Caleb Cushing <xenoterracide@gmail.com>)
List pgsql-hackers
On mån, 2009-11-23 at 12:50 -0500, Caleb Cushing wrote:
> and domains
> only seem right if it's something, like a zip code, that has a very
> specific set of rules, that is in reality it's own type.

A domain is not really its own type, it's a domain over its base type.
Hence the name.

> where
> specifying something like 'empty' feels as generic (and arbitrary?) as
> null.

The problem with your empty constraint is that it's data type specific,
and therefore the operator is also different depending on context.  So
either you create a "named generic constraint" for every data type you
are interested in (in that case, see domains), or the thing could at
best work as a text substitution mechanism, which is something that SQL
typically doesn't do.

> empty is not the only example (I'm sure), just the best I can
> think of.

I doubt that there are any really good examples that cannot be solved
with the current facilities.



pgsql-hackers by date:

Previous
From: Alexey Klyukin
Date:
Subject: arrays as input parameters in plperl
Next
From: Marko Tiikkaja
Date:
Subject: Re: Writeable CTE patch