Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 1CCC9475F81 for ; Thu, 2 May 2002 18:13:23 -0400 (EDT) Received: from leo.pcisys.net (leo.pcisys.net [207.76.102.240]) by postgresql.org (Postfix) with ESMTP id 5F872475DF8 for ; Thu, 2 May 2002 17:33:41 -0400 (EDT) Received: from [208.202.106.254] (moe1.meg106-254.cos.pcisys.net [208.202.106.254]) by leo.pcisys.net (8.12.1/8.12.1) via ESMTP id g42LXgMW015846 for ; Thu, 2 May 2002 15:33:42 -0600 (MDT) env-from (hierophant@pcisys.net) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.4 Date: Thu, 02 May 2002 15:33:41 -0600 Subject: Re: boolean error From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <5.1.0.14.2.20020502122037.00a6ef60@mail.host45.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Archive-Number: 200205/21 X-Sequence-Number: 1153 on 5/2/02 10:31 AM, pippo@videotron.ca purportedly said: > I am getting this in the error log file: > ERROR: Bad boolean external representation > 'color=red>YES>' > > The code that is generating the message is all within the php delimiters > (entire file) and appears several times as follows: > > if($r1==0 || $r2==0) { > if($archived=='Y') { > $archived="YES"; > } > ;;; > > select wares.ware_id,wares.name,category.name,unit_size, > qty_per_shipping_unit,supplier.name,sku, > case when wares.archived='t' then 'YES' > else wares.archived end as archived, All return results of a case statement must be coercible to the same type. Postgres can't coerce 'YES' into a boolean value (i.e. wares.archived), hence the error. Since booleans can't be cast to another type, simply return the expected value: CASE wares.archived WHEN 't' THEN 'YES' WHEN 'f' THEN 'f' ELSE NULL END AS archived Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"