Re: WIP: generalized index constraints

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: generalized index constraints
Date: 2009-08-20 08:47:20
Message-ID: 4A8D0D98.7070202@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis wrote:
> I'm going to try to get this patch ready for the 9-15 commitfest. Here
> are a few design updates:
>
> (1) Language:
>
> I think that the new language should be a table constraint, and I think
> there's a consensus on that. The specific language I have in mind is:
>
> CREATE TABLE (
> ...,
> INDEX CONSTRAINT (<attname> <op>, ...) USING INDEX <indexname>
> );

That sounds like the constraint is based on an existing index, but there
can't be any existing indexes on a table that hasn't been created yet.
If this creates the index, then the syntax needs to support specifying
index access method and an opclass for all the columns.

> ALTER TABLE ADD INDEX CONSTRAINT (<attname> <op>, ...)
> USING INDEX <indexname>;
>
> Where <op> is the constraint operator. For example, if all <op>s are
> "=" (or whatever the operator for BTEqualStragey is for that type), that
> would be semantically identical to a UNIQUE constraint.

This makes more sense.

It would be nice to have syntax to create the index and constraint in
one command, so that the constraint can be checked while the index is
being created. Otherwise you need an extra heap scan to check it.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-08-20 13:27:58 Re: hot standby - merged up to CVS HEAD
Previous Message Heikki Linnakangas 2009-08-20 06:14:20 Re: FDW-based dblink (WIP)