Re: weird situation, BUG or I'm not doing it right - Mailing list pgsql-sql

From Tom Lane
Subject Re: weird situation, BUG or I'm not doing it right
Date
Msg-id 5937.1030288842@sss.pgh.pa.us
Whole thread Raw
In response to Re: weird situation, BUG or I'm not doing it right  ("Michael Paesold" <mpaesold@gmx.at>)
List pgsql-sql
"Michael Paesold" <mpaesold@gmx.at> writes:
> It seems that when comparing char with text, the comparision is done
> as text, not as bpchar.

Yup.  Arguably this is a bad idea: the system ought to reject the
comparison entirely, and make you cast one side or the other so that
it's clear to all concerned which comparison semantics you want.
However, I don't see any way to do that without also breaking a lot
of cases that are convenient and don't confuse anyone ... like, say,
the fact that you can apply upper() to char(n) data in the first place.
Upper is declared as "upper(text) returns text".

You might care to read the User's Guide's discussion of type conversion,
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/typeconv.html
The particular behavior at hand emerges from the fact that text is
considered the preferred datatype in the string category.
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: left join query does not perform well
Next
From: Andreas Tille
Date:
Subject: Re: Separating data sets in a table