Re: [SQL] filtering after join

2006-01-27 Thread andrew
I can see the final plan by using the EXPLAIN command. But I want to know the procedure of the planner in handling nesting queries. Can you direct me to the corresponding part of the code and/or the documents? Thanks. On 1/26/06, Peter Eisentraut [EMAIL PROTECTED] wrote: andrew wrote: How will

Re: [SQL] filtering after join

2006-01-27 Thread andrew
I got errors in this query. I have a function complete(record) which takes a generic record type data. But it seems cannot be applied to a sub-select result: backend explain select * from (select * from Person,Auction where Person.id=Auction.seller) as s where complete(s) QUERY: explain select *

Re: [SQL] filtering after join

2006-01-27 Thread Tom Lane
andrew [EMAIL PROTECTED] writes: I got errors in this query. I have a function complete(record) which takes a generic record type data. But it seems cannot be applied to a sub-select result: As I seem to recall having mentioned several times already, PG 7.3 is really, really weak in this area.

Re: [SQL] filtering after join

2006-01-27 Thread andrew
I have traced the code. It exits when the argument is the result of a join or a subselect in function ParseFuncOrColumn(). The reason mentioned in the comments is lack of named tuple type. How can force it to create such a tuple type? is there a way? thanks a million times! On 1/27/06, Tom Lane

Re: [SQL] filtering after join

2006-01-26 Thread Peter Eisentraut
andrew wrote: Sorry for the confusion. This is what i meant. Thanks, Michael. select * from (select * from A, B where A.a = B.b) as s where foo(s) 2; On 1/25/06, Peter Eisentraut [EMAIL PROTECTED] wrote: andrew wrote: I want to use a UDF to filter tuples t that are generated after a

Re: [SQL] filtering after join

2006-01-26 Thread andrew
But the function foo() would produce different values for the two queries, so the result will be different. A simple example is foo() computes the sum of all the integer fields of the input record. On 1/26/06, Peter Eisentraut [EMAIL PROTECTED] wrote: andrew wrote: Sorry for the confusion.

Re: [SQL] filtering after join

2006-01-26 Thread Peter Eisentraut
andrew wrote: But the function foo() would produce different values for the two queries, so the result will be different. A simple example is foo() computes the sum of all the integer fields of the input record. OK, I see now where you're getting at. You want to combine the record type of A

Re: [SQL] filtering after join

2006-01-26 Thread Peter Eisentraut
andrew wrote: How will the query planner do for a nesting query? Treat the subqueries as multiple queries and then link them together? where can I find the information (codes or documents)? Look at the execution plan using the EXPLAIN command. -- Peter Eisentraut

[SQL] filtering after join

2006-01-25 Thread andrew
I want to use a UDF to filter tuples t that are generated after a join. More specifially, I have a UDF foo(record), which computes a value for a given tuple. I can do the filtering before the join. e.g.: select * from A, B where foo(A)2 and A.a=B.b; But I want to apply foo() to the tuples

Re: [SQL] filtering after join

2006-01-25 Thread Michael Fuhr
On Wed, Jan 25, 2006 at 06:27:33PM +0100, andrew wrote: I want to use a UDF to filter tuples t that are generated after a join. More specifially, I have a UDF foo(record), which computes a value for a given tuple. I can do the filtering before the join. e.g.: select * from A, B where

Re: [SQL] filtering after join

2006-01-25 Thread Peter Eisentraut
andrew wrote: I want to use a UDF to filter tuples t that are generated after a join. More specifially, I have a UDF foo(record), which computes a value for a given tuple. I can do the filtering before the join. e.g.: select * from A, B where foo(A)2 and A.a=B.b; What makes you think that

Re: [SQL] filtering after join

2006-01-25 Thread andrew
Sorry for the confusion. This is what i meant. Thanks, Michael. select * from (select * from A, B where A.a = B.b) as s where foo(s) 2; On 1/25/06, Peter Eisentraut [EMAIL PROTECTED] wrote: andrew wrote: I want to use a UDF to filter tuples t that are generated after a join. More