Re: Why does =ANY() need an extra cast when used - Mailing list pgsql-general

From Frank van Vugt
Subject Re: Why does =ANY() need an extra cast when used
Date
Msg-id 200408231737.39059.ftm.van.vugt@foxi.nl
Whole thread Raw
In response to Re: Greatest/Least functions?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: Why does =ANY() need an extra cast when used
List 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 by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Why does =ANY() need an extra cast when used
Next
From: Gaetano Mendola
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions