Re: named generic constraints [feature request]

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Caleb Cushing <xenoterracide(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: named generic constraints [feature request]
Date: 2009-11-23 21:30:25
Message-ID: 1259011825.2321.10.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2009-11-23 21:33:29 Re: Writeable CTE patch
Previous Message Alexey Klyukin 2009-11-23 19:19:24 arrays as input parameters in plperl