Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EF385475D22 for ; Sun, 25 Aug 2002 11:20:39 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5F8A9475CF8 for ; Sun, 25 Aug 2002 11:20:39 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g7PFKgZM005938; Sun, 25 Aug 2002 11:20:42 -0400 (EDT) To: "Michael Paesold" Cc: "Ross J. Reedstrom" , "Jiaqing Wang" , pgsql-sql@postgresql.org Subject: Re: weird situation, BUG or I'm not doing it right In-reply-to: <002201c24c35$d5bd0ef0$0100a8c0@beeblebrox> References: <20020825042730.GA6376@rice.edu> <002201c24c35$d5bd0ef0$0100a8c0@beeblebrox> Comments: In-reply-to "Michael Paesold" message dated "Sun, 25 Aug 2002 14:49:21 +0200" Date: Sun, 25 Aug 2002 11:20:42 -0400 Message-ID: <5937.1030288842@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/340 X-Sequence-Number: 9186 "Michael Paesold" 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