Re: Why does =ANY() need an extra cast when used

Поиск
Список
Период
Сортировка
От Frank van Vugt
Тема Re: Why does =ANY() need an extra cast when used
Дата
Msg-id 200408231737.39059.ftm.van.vugt@foxi.nl
обсуждение исходный текст
Ответ на Re: Greatest/Least functions?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Ответы Re: Why does =ANY() need an extra cast when used  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
> > works =# select 1 = ANY ('{1,2,3}'::int[]);
> > doesn't work =# select 1 = ANY (select '{1,2,3}'::int[]);
> > works =# select 1 = ANY ((select '{1,2,3}'::int[])::int[]);

I may be misinterpreting your reply but.....

My real-world application has a set-returning PL/pgSQL function for which I
created a type, so the function is returning rows of this type. One of the
fields in this type is an array of int.

> The second query looks to me to be of the form = ANY (table
> subquery) which already had defined behavior by spec.

Yes, what I want is to be able to do something like:

select some_fields
from some_table
where some_int = ANY(
    select field_of_type_array_of_int
    from plpgsql_method_returning_custom_type
    where we_just_return_a_single_record);

But this won't work, so I'm not quite getting what you mean by 'which already
had defined behavior by spec'

> Changing it to act like the first or last would break that spec behavior.

Ok, but I'm mainly looking for the 'proper' way to make this work, not
necessarily using a syntax like the first or last example.




--
Best,




Frank.


В списке pgsql-general по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Why does =ANY() need an extra cast when used
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions