X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C28C2D1B577 for ; Thu, 25 Sep 2003 04:45:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 55670-05 for ; Thu, 25 Sep 2003 01:45:31 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 944E9D1B519 for ; Thu, 25 Sep 2003 01:45:30 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3678610; Wed, 24 Sep 2003 21:46:01 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "George A.J" , pgsql-sql@postgresql.org Subject: Re: Case Insensitive comparison Date: Wed, 24 Sep 2003 21:45:21 -0700 User-Agent: KMail/1.4.3 References: <20030925033550.35699.qmail@web14915.mail.yahoo.com> In-Reply-To: <20030925033550.35699.qmail@web14915.mail.yahoo.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200309242145.21087.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/292 X-Sequence-Number: 15270 jinujose, > i am using postgresql 7.3.x. I am converting a database in MS SQL server to > PostgreSQL. Good luck to you! > The main problems i am facing is that in sql server the text comparisons > are case insensitive. how can i compare text case insensitive in postgresql > without using an upper() or lower() function in both sides (=). Is there > any option to set in postgresql? Is there any problem in overriding the = > operator that compare text. ie droping the current operator = and creating > a new = operator(text,text). Does the existing = operator is using > internally by postgres for some porpose. please help I would *not* suggest modifying such a fundamental operator; you are very likely to break something. You can use "ILIKE" to compare text: 'Joe' ILIKE 'joE' == true You can also use the "regex" operator: 'Joe' ~* '^jOE$' == TRUE ... but that takes more adaptation. However, neither of the above approaches can be indexed. > Another problem is in creating function... > How can i create a function that accept and return any type. the type "any" > is not allowing as parameter or return type. Is it possible? i want to > create a function similar to NULLIF(). You can't, nor will you be able to -- in te future, some 7.4 functions will be able to *accept* any type, but they will still return a specific type. Instead, you need to create a seperate NULLIF() for each data type you're likely to use. -- Josh Berkus Aglio Database Solutions San Francisco