Re: Questions about parsing boolean and casting to anyelement

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Questions about parsing boolean and casting to anyelement
Дата
Msg-id
17184.1234799324@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Questions about parsing boolean and casting to anyelement ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Re: Questions about parsing boolean and casting to anyelement Tom Lane <tgl@sss.pgh.pa.us>
Re: Questions about parsing boolean and casting to anyelement ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Re: Questions about parsing boolean and casting to anyelement Tom Lane <tgl@sss.pgh.pa.us>
Re: Questions about parsing boolean and casting to anyelement Sam Mason <sam@samason.me.uk>
Re: Questions about parsing boolean and casting to anyelement Tom Lane <tgl@sss.pgh.pa.us>
Re: Questions about parsing boolean and casting to anyelement Tom Lane <tgl@sss.pgh.pa.us>
Re: Questions about parsing boolean and casting to anyelement Pavel Stehule <pavel.stehule@gmail.com>
Re: Questions about parsing boolean and casting to anyelement Brendan Jurd <direvus@gmail.com>
Re: Questions about parsing boolean and casting to anyelement Tom Lane <tgl@sss.pgh.pa.us>
Allow on/off as input texts for boolean. ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Re: Allow on/off as input texts for boolean. Peter Eisentraut <peter_e@gmx.net>
Re: Allow on/off as input texts for boolean. ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Re: Allow on/off as input texts for boolean. Peter Eisentraut <peter_e@gmx.net>
ITAGAKI Takahiro  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

В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
От: Tom Lane
Дата:
FAQ