Re: Re: Is this a bug in 7.1? - Mailing list pgsql-general

From Richard Huxton
Subject Re: Re: Is this a bug in 7.1?
Date
Msg-id 006e01c0abbb$abf702e0$1001a8c0@archonet.com
Whole thread Raw
In response to Re: Is this a bug in 7.1?  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Victor Muntes Mutero
Date:
Subject: Execution plans for tpc-h
Next
From: Mark Stosberg
Date:
Subject: tips document available for 6.5 to 7.0.x upgrade