pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: George A.J <jinujosein@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Case Insensitive comparison
Date: Thu, 25 Sep 2003 01:50:02 -0400
Message-ID: <2176.1064469002@sss.pgh.pa.us> (raw)
In-Reply-To: <200309242145.21087.josh@agliodbs.com>
References: <20030925033550.35699.qmail@web14915.mail.yahoo.com>
	<200309242145.21087.josh@agliodbs.com>

Josh Berkus <josh@agliodbs.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



view thread (9+ messages)  latest in thread

Message-ID: <2176.1064469002@sss.pgh.pa.us>
Permalink:  ../2176.1064469002@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2176.1064469002@sss.pgh.pa.us

 · 

reply

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, josh@agliodbs.com, jinujosein@yahoo.com
  Subject: Re: Case Insensitive comparison
  In-Reply-To: <2176.1064469002@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