Re: WIP: generalized index constraints

From: David Fetter <david(at)fetter(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Brendan Jurd <direvus(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: generalized index constraints
Date: 2009-09-15 19:03:16
Message-ID: 20090915190316.GI19673@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 15, 2009 at 11:31:48AM -0700, Jeff Davis wrote:
> On Tue, 2009-09-15 at 13:48 -0400, Robert Haas wrote:
> > So it allows us to create constraints of the following form?
> >
> > For all A in the index, there exists no B in the index such that the
> > given operator (which must be a binary operator returning boolean)
> > holds of A and B.
>
> Yes. And it's slightly more complicated for multi-column constraints:
>
> For all tuples A in the index with attributes 1 to N, there exists no
> tuple B such that:
> A1 op1 B1 AND
> A2 op2 B2 AND
> ...
> AN op2 BN
>
> If all operators are "=", and the index implements searching on
> equality, it's semantically equivalent to a unique index.

Interesting :) I take it op1..opN (it's opN, not op2, right?) need to
commute?

> > These are certainly less common requirements than what you're
> > talking about here, and I don't think it's important to try to
> > support them - at least not at this point - but the word
> > "generalized" doesn't give me a clue that I won't be able to do
> > those things but I will be able to make an index that prevents my
> > users from handing out duplicate IP blocks.
>
> As far as the name goes, the best I've got so far are "index
> constraints" and "generalized index constraints". I'm happy to change
> the name if you have a reasonable suggestion.

Here's a couple:

* "generalized-uniqueness constraints"
the hyphen disambiguates

* "operator-based constraints"
A little math-ier, but talks about the API rather than details of
the server implementation.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-15 19:04:50 Re: WIP: generalized index constraints
Previous Message Kevin Grittner 2009-09-15 18:49:30 Re: Timestamp to time_t