CREATE UNIQUE INDEX copy_barcode_key ON asset.copy (barcode) WHERE deleted = FALSE;
(which I have confirmed provides the same results as deleted = 'f'). If we want to support ad-hoc queries or other tools that might generate the IS FALSE expression, then the overhead of:
CREATE UNIQUE INDEX copy_barcode_key ON asset.copy (barcode) WHERE deleted = FALSE OR deleted IS FALSE;
should be miniscule. I'd suggest going with the latter, personally.
I've also bugged #postgresql to say "Hey, shouldn't the planner recognize that IS FALSE and deleted = FALSE are the same damn thing"; there was some interest, so who knows, maybe the mess will be cleared up by 9.0?
http:// www.postgresql. org/docs/ 8.3/static/ datatype- boolean. html says "Using the key words TRUE and FALSE is preferred (and SQL-compliant).", so for the minimal "make cstore happy" case we should probably go with:
CREATE UNIQUE INDEX copy_barcode_key ON asset.copy (barcode) WHERE deleted = FALSE;
(which I have confirmed provides the same results as deleted = 'f'). If we want to support ad-hoc queries or other tools that might generate the IS FALSE expression, then the overhead of:
CREATE UNIQUE INDEX copy_barcode_key ON asset.copy (barcode) WHERE deleted = FALSE OR deleted IS FALSE;
should be miniscule. I'd suggest going with the latter, personally.
I've also bugged #postgresql to say "Hey, shouldn't the planner recognize that IS FALSE and deleted = FALSE are the same damn thing"; there was some interest, so who knows, maybe the mess will be cleared up by 9.0?