Re: [PROPOSAL] Covering + unique indexes. - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: [PROPOSAL] Covering + unique indexes.
Date
Msg-id 55F6F7AD.4080307@BlueTreble.com
Whole thread Raw
In response to [PROPOSAL] Covering + unique indexes.  (Anastasia Lubennikova <a.lubennikova@postgrespro.ru>)
Responses Re: [PROPOSAL] Covering + unique indexes.
List pgsql-hackers
On 9/11/15 7:45 AM, Anastasia Lubennikova wrote:
> This idea has obvious restriction. We can set unique only for first
> index columns.
> There is no clear way to maintain following index.
> CREATE INDEX index ON table (c1, c2, c3) UNIQUE ON (c1, c3);
>
> So I suggest following syntax:
> CREATE [UNIQUE {ON FIRST {COLUMN | n_unique_column COLUMNS}} INDEX ON
> table_name (column_name1, column_name2 ...);

I would use the first (simple) syntax and just throw an error if the 
user tries to skip a column on the UNIQUE clause.

Have you by chance looked to see what other databases have done for 
syntax? I'm guessing this isn't covered by ANSI but maybe there's 
already an industry consensus.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: RLS open items are vague and unactionable
Next
From: Egon Kocjan
Date:
Subject: [PATCH] add --log-output to pg_ctl on Windows