From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | anyelement -> anyrange |
Date: | 2016-08-16 02:58:43 |
Message-ID: | 787ba701-72dd-9a05-3085-45607159288f@BlueTreble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Any reason why we can create a function that accepts anyelement and
returns anyarray, but can't do the same with anyrange? Could we attempt
to match each range subtype looking for a match?
create function range__create(anyelement,anyelement,text = '[]') RETURNS
anyrange LANGUAGE plpgsql AS $body$
BEGIN
RETURN int4range($1,$2,$3)
END$body$;
ERROR: 42P13: cannot determine result data type
DETAIL: A function returning "anyrange" must have at least one
"anyrange" argument.
create function array__create(anyelement,anyelement) RETURNS anyarray
LANGUAGE plpgsql AS $body$
BEGIN
RETURN array[$1,$2];
END$body$;
CREATE FUNCTION
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-08-16 03:12:58 | Re: anyelement -> anyrange |
Previous Message | Robert Haas | 2016-08-16 02:16:08 | Re: max_parallel_degree > 0 for 9.6 beta |