Greetings! I have the following query: select charge.charge, alarm_history.area || '!', bases.area || '!', alarm_history.area::character varying(32) = bases.area::character varying(32), alarm_history.area <> bases.area, alarm_history.* from charge JOIN bases ON charge.base::text = bases.base::text inner join alarm_history on charge.charge = alarm_history.charge or ( alarm_history.alarm_date > charge.fire_date and ( alarm_history.alarm_date < charge.cold_date or charge.cold_date is null ) and device = 'Global') where charge.charge = 64489 This query returns 9 records. For all of them, alarm_history.area is 'Anneal' and bases.area is 'Anneal'. Yet, the column for the equality test is always "f" and the column for the inequality test is always "t"!
The alarm_history table definition begins with: CREATE TABLE alarm_history ( alarm_pkey bigserial NOT NULL, area character varying(32), -- shop area and the bases table definition has: CREATE TABLE bases ( area character varying(32) NOT NULL DEFAULT 'All'::character varying, I have no idea why these two look to be different. I've tried appending an exclamation point to both of them to check for extra spaces at the end. There aren't any. I've tried casting them both to text and to character varying(32), but I got the same results. I'm running PostgreSQL 8.4 on WinXP Pro. I get the same results on a customer's machine running a 64-bit Windows OS, using an identical database. Can anyone explain this, please? RobR