pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: possible bug with group by?
Date: Wed, 24 May 2000 18:03:25 -0500
Message-ID: <20000524180325.A19078@rice.edu> (raw)
In-Reply-To: <392C5819.2FD488A8@selectacast.net>
References: <392C5819.2FD488A8@selectacast.net>

On Wed, May 24, 2000 at 06:30:49PM -0400, Joseph Shraibman wrote:
> Is this a bug or am I just misunderstanding something?
> 

Not a bug, pgsql is just less willing to cast things willy-nilly
in 7.0 than it was in 6.x.  In this case, the system doesn't know what
'not set' and 'set' are supposed to be, so if can't decide what operator
to use to compare them for grouping. Try something like:

 select a, b, case when c is null then 'not set'::text else 'set'::text end
   as z from tablea group by a, b, z;

Or even SQL92 compliant:

select a, b, case when c is null then CAST ('not set' AS TEXT)  else CAST
('set' as text) end as z from tablea group by a, b, z;


> 
> playpen=> select a, b, case when c is null then 'not set' else 'set' end
> as z from tablea group by a, b, z;
> ERROR:  Unable to identify an operator '<' for types 'unknown' and
> 'unknown'
>         You will have to retype this query using an explicit cast
> playpen=>
> 

Ross
-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005



view thread (8+ messages)  latest in thread

Message-ID: <20000524180325.A19078@rice.edu>
Permalink:  ../20000524180325.A19078@rice.edu/
Also on:    postgresql.org/message-id/20000524180325.A19078@rice.edu

 · 

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-sql@postgresql.org
  Cc: reedstrm@rice.edu
  Subject: Re: possible bug with group by?
  In-Reply-To: <20000524180325.A19078@rice.edu>
  References: <392C5819.2FD488A8@selectacast.net> <20000524180325.A19078@rice.edu>

* 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