Search Postgresql Archives

Re: domains, case statements, functions: bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/08/2013 10:26 AM, Joe Van Dyk wrote:
create domain m numeric(5,2);
create table t (c m);
create function f(t) returns m as $ select case when true then $1.c end
$ language sql;


psql:/tmp/t1.sql:3: ERROR:  return type mismatch in function declared to
return m
DETAIL:  Actual return type is numeric.
CONTEXT:  SQL function "f"

Interesting:

test=> select case when true then t.c end from t;
 case
-------
 54.36
(1 row)

test=> create function f(t) returns m as $$ select case when true then $1.c end $$ language sql; ERROR: return type mismatch in function declared to return m

DETAIL: Actual return type is numeric.

CONTEXT:  SQL function "f"

test=> create function f(t) returns numeric as $$ select case when true then $1.c end $$ language sql;
CREATE FUNCTION

test=> select f(t);
ERROR:  column "t" does not exist
LINE 1: select f(t);

I will admit I am at a loss. Maybe someone else can illuminate.

--
Adrian Klaver
adrian.klaver@xxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux