Skip site navigation (1) Skip section navigation (2)

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

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why does =ANY(<array>) need an extra cast when used
Date: 2004-08-23 15:37:39
Message-ID: 200408231737.39059.ftm.van.vugt@foxi.nl (view raw or flat)
Thread:
Lists: 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.


In response to

Responses

pgsql-general by date

Next:From: Wayne FangDate: 2004-08-23 15:58:49
Subject: libpq on the server
Previous:From: Gaetano MendolaDate: 2004-08-23 15:36:29
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group