pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keary Suska <hierophant@pcisys.net>
To: Postgres-PHP <pgsql-php@postgresql.org>
Subject: Re: boolean error
Date: Thu, 02 May 2002 15:33:41 -0600
Message-ID: <B8F70CD5.DF7B%hierophant@pcisys.net> (raw)
In-Reply-To: <5.1.0.14.2.20020502122037.00a6ef60@mail.host45.com>

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
> '<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"




view thread (6+ messages)  latest in thread

Message-ID: <B8F70CD5.DF7B%hierophant@pcisys.net>
Permalink:  ../B8F70CD5.DF7B%25hierophant@pcisys.net/
Also on:    postgresql.org/message-id/B8F70CD5.DF7B%hierophant@pcisys.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: hierophant@pcisys.net
  Subject: Re: boolean error
  In-Reply-To: <B8F70CD5.DF7B%hierophant@pcisys.net>
  References: <5.1.0.14.2.20020502122037.00a6ef60@mail.host45.com> <B8F70CD5.DF7B%hierophant@pcisys.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox