On Fri, 2007-10-05 at 10:52 -0400, Tom Lane wrote:
> Simon Riggs <[EMAIL PROTECTED]> writes:
> > ...which is fine on just one table, but I want to join...
> 
> > postgres=# select * from c where col1 = any (select col2 from c);
> > ERROR:  operator does not exist: integer = integer[]
> 
> That isn't a join.  Are you looking for something like

I guess I was looking for the sub-select way of doing it, because I
actually wanted to exclude rows.

> select * from c, c as c2 where c.col1 = any (c2.col2)

That works, thanks. 

As I said, I already solved the problem a different way. I was looking
to understand the 3 questions I raised along the way.

Can you throw any light on those questions?
1. Why doesn't the subselect work?

2. Why does a function returning a polymorphic type have to have at
least one polymorphic argument? It's easy to create a function that
returns a polymorphic result yet has no linkage at all to the input.

3. Why is a composite type with just one attribute not the same type as
the attribute? We know this is possible in the SELECT list, but we don't
know its the same thing in other contexts.

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to