Re: Case Insensitive comparison

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: "George A(dot)J" <jinujosein(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Case Insensitive comparison
Date: 2003-09-25 05:50:02
Message-ID: 2176.1064469002@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus <josh(at)agliodbs(dot)com> 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Przemysław Słupkowski 2003-09-25 06:36:42 Sequenties in pgSQL 7.3.x
Previous Message Roberto Mello 2003-09-25 05:30:08 Re: Case Insensitive comparison