From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paesold <mpaesold@gmx.at>
Cc: Ross J. Reedstrom <reedstrm@rice.edu>
Cc: Jiaqing Wang <jjw72@swbell.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: weird situation, BUG or I'm not doing it right
Date: Sun, 25 Aug 2002 11:20:42 -0400
Message-ID: <5937.1030288842@sss.pgh.pa.us> (raw)
In-Reply-To: <002201c24c35$d5bd0ef0$0100a8c0@beeblebrox>
References: <KCEJKHPEBJGGCDBEMMNKIEGCCBAA.jjw72@swbell.net>
<20020825042730.GA6376@rice.edu>
<002201c24c35$d5bd0ef0$0100a8c0@beeblebrox>
"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
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mpaesold@gmx.at, reedstrm@rice.edu, jjw72@swbell.net
Subject: Re: weird situation, BUG or I'm not doing it right
In-Reply-To: <5937.1030288842@sss.pgh.pa.us>
* 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