Re: Array with Subselect / ANY - cast?

From: Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Array with Subselect / ANY - cast?
Date: 2007-08-21 19:43:53
Message-ID: 20070821144353.5c8412ca@sinkhole.intrcomm.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 21 Aug 2007 21:36:00 +0200
"Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> wrote:

> it works? no.
>
> pavel=# select 1 from (values(10)) a(i) where i = any((select *
> from foo)::int[]);
> ERROR: cannot cast type integer to integer[]
> LINE 1: ...values(10)) a(i) where i = any((select * from
> foo)::int[]); ^
> pavel=#

oops - forgot to send to list:

This is the exact query I ran which produces a result set:

select * from tblproducts
where productid = ANY(
(select pb_correspondence from pb.pb_nurse
where id = 140)::integer[]
)
order by productid;

Your query looks similar - maybe it's the "select *" in the subquery?

Either way I actually found a better way to do what I was trying to
do here so no worries. :)

Josh

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2007-08-21 19:45:12 Re: history table
Previous Message Dmitry Koterov 2007-08-21 19:43:26 Re: Need help doing a PostgreSQL vs Firebird feature comparison