Thank you for your reply, the procedure code (which I posted in the original post) already utilizes the Execute statment. Here is the weirdest thing. The error only occurs in the query window that I originally wrote the code in. If I open another query window (I'm using PGAdmin III), I can run the code a number of times with no error. (In short there is no problem restraining me from what I am doing, it just threw me for a loop for a while.) Sim ________________________________________________________________________________ On Tue, 2005-10-11 at 07:55 +0200, Sim Zacks wrote: > I tried it on a test RedHat server > PostgreSQL 8.0.2beta1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7) > and the problem didn't occur. It is a slightly newer version, though, > so it doesn't prove anything. But the Gentoo is my production machine, > so I guess I'll have to figure out a way around it. I'll post again if > if I can figure out exactly where the problem is occurring. You were doing the creation of the temporary table in a function. Did it go wrong on the very first execution in a session or only on the second and subsequent executions? If the latter, try using EXECUTE in the function, so that the statement is reevaluated each time. -- Oliver Elphick olly@xxxxxxxxxx Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA ======================================== Do you want to know God? http://www.lfix.co.uk/knowing_god.html ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend