ITAGAKI Takahiro <itagaki.takah...@oss.ntt.co.jp> writes:
>   - Are there any limitations in casting to anyelement?

It's a no-op ... probably we shouldn't even let you do it, if the
lack of an error leaves room for such misinterpretation as this.
anyelement and friends are placeholders for use in function
declarations, not real types that it makes sense to cast to.

>     CREATE FUNCTION array_find(text[], text, anyelement)
>     RETURNS anyelement AS
>     $$
>         SELECT substring(i from E'\\W*=(.*)')::anyelement
>           FROM unnest($1) AS t(i) WHERE i LIKE $2 || '=%'
>          UNION ALL SELECT $3 LIMIT 1
>     $$
>     LANGUAGE sql IMMUTABLE STRICT;

The substring() necessarily produces type text, so I dunno why you
think $3 needs to be anything but text.

                        regards, tom lane

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

Reply via email to