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 CAD91D1B4E6 for ; Thu, 25 Sep 2003 14:04:36 +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 07636-01 for ; Thu, 25 Sep 2003 11:04:08 -0300 (ADT) Received: from web14908.mail.yahoo.com (web14908.mail.yahoo.com [216.136.225.60]) by svr1.postgresql.org (Postfix) with SMTP id 30FCCD1B51A for ; Thu, 25 Sep 2003 11:04:04 -0300 (ADT) Message-ID: <20030925140407.64555.qmail@web14908.mail.yahoo.com> Received: from [202.9.168.38] by web14908.mail.yahoo.com via HTTP; Thu, 25 Sep 2003 07:04:07 PDT Date: Thu, 25 Sep 2003 07:04:07 -0700 (PDT) From: "George A.J" Subject: Re: Case Insensitive comparison To: pgsql-sql@postgresql.org In-Reply-To: <2176.1064469002@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-667277437-1064498647=:63977" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/308 X-Sequence-Number: 15286 --0-667277437-1064498647=:63977 Content-Type: text/plain; charset=us-ascii Thanks to all of you for your valuable suggesstions.... does postgresql internally uses the = operator(text,text) for any other purposes. i think that overloading it solves the index problem too... Tom Lane wrote: Josh Berkus writes: >> 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. Au contraire. The 7.4 polymorphic-function features may well solve jinujose's problem, if he can indeed write a type-independent function body. For example create function nullif(anyelement, anyelement) returns anyelement as 'select case when $1 = $2 then null else $1 end' language sql; I'm not sure we're all the way there yet, cf http://archives.postgresql.org/pgsql-general/2003-09/msg00500.php regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster --------------------------------- Do you Yahoo!? The New Yahoo! Shopping - with improved product search --0-667277437-1064498647=:63977 Content-Type: text/html; charset=us-ascii

Thanks to all of you for your valuable suggesstions....
does postgresql internally uses the = operator(text,text) for any other purposes.
i think that overloading it solves the index problem too...
 
 

Tom Lane <tgl@sss.pgh.pa.us> wrote:
Josh Berkus writes:
>> 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.

Au contraire. The 7.4 polymorphic-function features may well solve
jinujose's problem, if he can indeed write a type-independent function
body. For example

create function nullif(anyelement, anyelement) returns anyelement as
'select case when $1 = $2 then null else $1 end' language sql;

I'm not sure we're all the way there yet, cf
http://archives.postgresql.org/pgsql-general/2003-09/msg00500.php

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search --0-667277437-1064498647=:63977--