From: "Oliver Elphick" <olly@lfix.co.uk>
> "Oliver Elphick" wrote:
> >Is this a bug or missing feature in 7.1? or have I got the SQL
> >wrong?
> >
> >bray=# SELECT DISTINCT p.id, p.name, a.town
> >bray-# FROM (
> >bray(# SELECT id, name
> >bray(# FROM customer
> >bray(# UNION
> >bray(# SELECT id, name
> >bray(# FROM supplier
> >bray(# ) AS p
> >bray-# LEFT OUTER JOIN address AS a
> >bray-# ON p.address = a.id
> >bray-# WHERE p.id = '22002';
>
> The SQL was wrong; I had missed out "address" from the fields in the
> subselect. However, the error message was very misleading:
>
> >ERROR: function applied to tuple is not supported for subSELECTs
> >
> >What does the error message mean? I can't see where a function
> >is involved.
Misleading, but does make some sense. Looks like you can define a function
with a table-name as parameter and use it as though an attribute:
create function foo(tbl) returns...
select tbl.foo;
Seems to call the function foo(...) - something to do with defining your own
types?
- Richard Huxton