Re: boolean error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



on 5/2/02 10:31 AM, pippo@xxxxxxxxxxxx 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"



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux