[GENERAL] Unique constraints and indexes.

2016-01-05 Thread Steve Rogerson
Is this a bug? I create a "unique" index, directly but it doesn't add a unique constraint. Add a unique constraint and it adds the index and the constraint. (pg version 9.4.5 on fedora 22, but also occurs in other versions). Functionally I can't see a difference. mydb=# create table test_table (

Re: [GENERAL] Unique constraints and indexes.

2016-01-05 Thread Tom Lane
Steve Rogerson writes: > On 05/01/16 19:47, Tom Lane wrote: >> That's operating as designed. A unique constraint needs an index, >> but not vice versa. > I can see that might be plausible , hence the question but as a "unique index" > imposes as constraint they seem

Re: [GENERAL] Unique constraints and indexes.

2016-01-05 Thread Steve Rogerson
On 05/01/16 19:47, Tom Lane wrote: > Steve Rogerson writes: >> Is this a bug? I create a "unique" index, directly but it doesn't add a >> unique >> constraint. Add a unique constraint and it adds the index and the constraint. > > That's operating as designed. A

Re: [GENERAL] Unique constraints and indexes.

2016-01-05 Thread Tom Lane
Steve Rogerson writes: > Is this a bug? I create a "unique" index, directly but it doesn't add a unique > constraint. Add a unique constraint and it adds the index and the constraint. That's operating as designed. A unique constraint needs an index, but not vice

Re: [GENERAL] Unique constraints and indexes.

2016-01-05 Thread David G. Johnston
On Tuesday, January 5, 2016, Steve Rogerson wrote: > On 05/01/16 19:47, Tom Lane wrote: > > Steve Rogerson > writes: > >> Is this a bug? I create a "unique" index, directly but it doesn't add a > unique > >> constraint. Add a