Re: Postgresq 8,1 hangs when running function - Mailing list pgsql-novice

From ben sewell
Subject Re: Postgresq 8,1 hangs when running function
Date
Msg-id bf6c74d80608210631w65cd1dc0t4f6c2536f6fc754a@mail.gmail.com
Whole thread Raw
In response to Re: Postgresq 8,1 hangs when running function  (Michael Fuhr <mike@fuhr.org>)
Responses Re: Postgresq 8,1 hangs when running function  (Sean Davis <sdavis2@mail.nih.gov>)
Re: Postgresq 8,1 hangs when running function  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
Hi guys, thanks for the tips. Yup I ran the query with the joins in this time. Explain analyze returned 68 rows this time, in 570 MS. Is the MS time normal?
 
ok now I seem to be getting somewhere, inputting stuff into my function and now it's saying returned record type does not match expected record type, even thorugh I give the types of the fields in the query.  Any ideas? I've checked the fields I am expecting to be returned against what they are stored as in the DB and there are nothing different.
 
Cheers,
Ben

 
On 8/21/06, Michael Fuhr <mike@fuhr.org> wrote:
On Mon, Aug 21, 2006 at 08:37:21AM -0400, Sean Davis wrote:
> If your SQL from your function has the same behavior when you execute it, it
> is likely one of two problems:
>
> 1)  You are doing an unconstrained CROSS JOIN and getting a large result set

Check the parentheses around the OR expressions in the queries'
WHERE clauses.  The queries have their join conditions separated
by AND and then an OR that looks like it needs an extra set of
parentheses.  That is, instead of this:

AND cond1 AND cond2 AND (cond3 AND cond4) OR (cond5 AND cond6)

try this:

AND cond1 AND cond2 AND ((cond3 AND cond4) OR (cond5 AND cond6))

or

AND cond1 AND cond2 AND (cond3 AND cond4 OR cond5 AND cond6)

Otherwise, as Sean said, you're getting cross joins.

--
Michael Fuhr

pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Postgresq 8,1 hangs when running function
Next
From: Sean Davis
Date:
Subject: Re: Postgresq 8,1 hangs when running function