Re: [GENERAL] Alternatives to a unique indexes with NULL

2015-01-18 Thread Martijn van Oosterhout
On Sat, Jan 17, 2015 at 02:03:34PM +0100, Andreas Kretschmer wrote: > Peter Hicks wrote: > > > All, > > > > I have a Rails application on 9.3 in which I want to enforce a unique > > index on a set of fields, one of which includes a NULL-able column. > > > > According to > > http://www.postgre

Re: [GENERAL] Alternatives to a unique indexes with NULL

2015-01-17 Thread Andreas Kretschmer
Peter Hicks wrote: > All, > > I have a Rails application on 9.3 in which I want to enforce a unique > index on a set of fields, one of which includes a NULL-able column. > > According to > http://www.postgresql.org/docs/9.3/static/indexes-unique.html, btree > indexes can't handle uniqueness

Re: [GENERAL] Alternatives to a unique indexes with NULL

2015-01-17 Thread Peter Hicks
Hi John On 17/01/15 12:39, John McKown wrote: ​I read the above. As I understand it, you can have a unique index on a column which is NULL-able. That will guarantee that all the non-NULL values are unique. What it will not guarantee is that there will be at most one NULL value in the indexed c

Re: [GENERAL] Alternatives to a unique indexes with NULL

2015-01-17 Thread John McKown
On Sat, Jan 17, 2015 at 6:27 AM, Peter Hicks wrote: > All, > > I have a Rails application on 9.3 in which I want to enforce a unique > index on a set of fields, one of which includes a NULL-able column. > > According to http://www.postgresql.org/docs/9.3/static/indexes-unique.html, > btree indexe

[GENERAL] Alternatives to a unique indexes with NULL

2015-01-17 Thread Peter Hicks
All, I have a Rails application on 9.3 in which I want to enforce a unique index on a set of fields, one of which includes a NULL-able column. According to http://www.postgresql.org/docs/9.3/static/indexes-unique.html, btree indexes can't handle uniqueness on NULL columns, so I'm looking for