From: | Keary Suska <hierophant(at)pcisys(dot)net> |
---|---|
To: | Postgres-PHP <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: boolean error |
Date: | 2002-05-02 21:33:41 |
Message-ID: | B8F70CD5.DF7B%hierophant@pcisys.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
on 5/2/02 10:31 AM, pippo(at)videotron(dot)ca purportedly said:
> I am getting this in the error log file:
> ERROR: Bad boolean external representation
> '<font >color=red><b>YES></b></font>'
>
> 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="<font color=red><b>YES</b></font>";
> }
> ;;;
>
> select wares.ware_id,wares.name,category.name,unit_size,
> qty_per_shipping_unit,supplier.name,sku,
> case when wares.archived='t' then '<font color=red><b>YES</b></font>'
> else wares.archived end as archived,
All return results of a case statement must be coercible to the same type.
Postgres can't coerce '<font color=red><b>YES</b></font>' 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 '<font color=red><b>YES</b></font>'
WHEN 'f' THEN 'f'
ELSE
NULL
END AS archived
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2002-05-02 22:17:08 | Re: sql command |
Previous Message | Scott Marlowe | 2002-05-02 21:31:35 | Re: column insert |