coalesce view error - Mailing list pgsql-general

From mikeo
Subject coalesce view error
Date
Msg-id 3.0.1.32.20000615164837.00a92100@pop.spectrumtelecorp.com
Whole thread Raw
Responses Re: coalesce view error  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
hi, i have this view defined as:

create view mikeotest as
       select
coalesce(topflow_application.rpt_name,topflow_application.tfap_name) AS
ipd_desc,
       graphics_03.ipd_date,
       graphics_03.day,
       graphics_03.gr_bill_amt_total,
       graphics_03.gr_byte_qty_total,
       graphics_03.gr_ipd_sessions
FROM graphics_03, topflow_application
WHERE (graphics_03.ct_key = topflow_application.ib_ct_key
   or  graphics_03.ct_key = topflow_application.ob_ct_key);

which postgres generates this from:

SELECT CASE WHEN (topflow_application.rpt_name NOTNULL)
            THEN topflow_application.rpt_name
            WHEN (topflow_application.tfap_name NOTNULL)
            THEN topflow_application.tfap_name
            ELSE NULL::unknown
       END AS ipd_desc,
       graphics_03.ipd_date, graphics_03."day",
graphics_03.gr_bill_amt_total,
       graphics_03.gr_byte_qty_total, graphics_03.gr_ipd_sessions
  FROM graphics_03, topflow_application
 WHERE ((graphics_03.ct_key = topflow_application.ib_ct_key)
    OR (graphics_03.ct_key = topflow_application.ob_ct_key));

when i try to run this query against this view, i get the following:

select sum(gr_bill_amt_total), ipd_desc from mikeotest group by ipd_desc;
ERROR:  Unable to identify an equality operator for type 'unknown'


i've played with the postgres definition changing NULL::unknown to 'stuff'
and other variations without success.  any help would be appreciated.

the underlying table looks like this and has 2200+/- rows in it:

            Table "graphics_03"
     Attribute     |    Type     | Modifier
-------------------+-------------+----------
 ct_key            | float8      | not null
 ipd_date          | date        | not null
 day               | varchar(10) | not null
 ipd_sessions      | float8      |
 ipd_bill_amt      | float8      |
 ipd_byte_qty      | float8      |
 gr_ipd_sessions   | float8      |
 gr_bill_amt_total | float8      |
 gr_byte_qty_total | float8      |

thanks,

mikeo

pgsql-general by date:

Previous
From: "W. van den Akker"
Date:
Subject: Error-message in other language
Next
From: Richard Harvey Chapman
Date:
Subject: db design question