Re: [GENERAL] question about unique indexes

2010-05-10 Thread Alban Hertroys
On 10 May 2010, at 2:09, Jonathan Vanasco wrote: i was given a unique index on (country_id, state_id, city_id, postal_code_id) in the two records below, only country_id and state_id are assigned ( aside from the serial ) geographic_location_id | coordinates_latitude |

Re: [GENERAL] question about unique indexes

2010-05-10 Thread Jonathan Vanasco
On May 10, 2010, at 6:29 AM, Alban Hertroys wrote: As the docs state and as others already mentioned, Null values are not considered equal. Ah. I interpreted that wrong. I thought it applied to indexes differently. I'll have to experiment now... -- Sent via pgsql-general mailing

Re: [GENERAL] question about unique indexes

2010-05-10 Thread Tim Landscheidt
Alban Hertroys dal...@solfertje.student.utwente.nl wrote: [...] None of these solutions are pretty. It should be quite a common problem though, how do people normally solve this? Partial indexes? Doesn't look pretty either though: | tim=# \d DE_Postcodes | Tabelle »public.de_postcodes« |

[GENERAL] question about unique indexes

2010-05-09 Thread Jonathan Vanasco
-- running pg 8.4 i have a table defining geographic locations id lat long country_id not null state_id city_id postal_code_id i was given a unique index on (country_id, state_id, city_id, postal_code_id) the unique index isn't

Re: [GENERAL] question about unique indexes

2010-05-09 Thread Cédric Villemain
2010/5/10 Jonathan Vanasco postg...@2xlp.com: -- running pg 8.4 i have a table defining geographic locations        id        lat        long        country_id not null        state_id        city_id        postal_code_id i was given a unique index on        (country_id, state_id,

Re: [GENERAL] question about unique indexes

2010-05-09 Thread AI Rumman
Use unique index as follows: create unique index unq_idx on table_name (coalesce(country_id,0), coalesce(state_id,0), coalesce(city_id,0),coalesce(postal_code_id,0) ); On Mon, May 10, 2010 at 6:09 AM, Jonathan Vanasco postg...@2xlp.com wrote: -- running pg 8.4 i have a table defining