Re: Needed function IF(expr, expr, expr)

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Marek Lewczuk <newsy(at)lewczuk(dot)com>, pgsql-general(at)postgresql(dot)org, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Needed function IF(expr, expr, expr)
Date: 2003-09-07 23:25:30
Message-ID: 1062977129.54737.46.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> Any comments on the UNKNOWN issue? It's not too late to change that for
> 7.4, if we have consensus that we should.

I would actually prefer to get UNKNOWN so I can apply my own default
type, but we're not even given the chance to resolve the unknown issue
ourselves.

CREATE OR REPLACE FUNCTION if(bool,anyelement,anyelement)
RETURNS anyelement
AS 'SELECT
CASE WHEN $2 is of (unknown) THEN
CASE WHEN $1 THEN $2::point ELSE $3::point END
ELSE
CASE WHEN $1 THEN $2 ELSE $3 END
END' language SQL;
CREATE FUNCTION
rbt=# select if(true, '33', '44');
ERROR: could not determine ANYARRAY/ANYELEMENT type because input is
UNKNOWN

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-09-08 00:38:05 Re: Needed function IF(expr, expr, expr)
Previous Message Greg Stark 2003-09-07 23:00:03 Re: [GENERAL] Needed function IF(expr, expr, expr)

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2003-09-07 23:52:39 Re: table-level and row-level locks.
Previous Message Jenny - 2003-09-07 23:07:42 Re: table-level and row-level locks.