WHERE condition lost from conditional unique index

From: jake fagan <jakeofagan(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: WHERE condition lost from conditional unique index
Date: 2014-06-06 16:38:45
Message-ID: CAJrpLW9FALyzDmEkhPz0Znuc_nah3kVnS+EEbMFpeuZy947bHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am attempting to apply an Unique Index in Postgresql with mixed results.
I am generating the index via a Ruby on Rails migration. The up statement
looks like:

execute("create unique index formatted_address_unit_number_and_status
on properties (formatted_address, unit_number)
where status = 'published';")

On my local development the index works as intended. If I take a look at
the properties table by running \d properties, the migration correctly
added index like so:

"formatted_address_unit_number_and_status" UNIQUE,
btree (formatted_address, unit_number) WHERE status::text = 'published'::text

However, when my Jenkins CI server runs the migration, I only see the
following in the propertiestable:

"formatted_address_unit_number_and_status" UNIQUE,
btree (formatted_address, unit_number)

Why would the migration work on my development but not on Jenkins? Am I
applying the unique index correctly to begin with?

--
Jake Fagan

Ruby Engineer
jakeofagan(at)gmail(dot)com
503.449.3464

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David G Johnston 2014-06-06 18:56:26 Re: WHERE condition lost from conditional unique index
Previous Message Yuksel Pinarbasi 2014-06-06 13:07:22 Re: 64 bit or 32 bit?