Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7BE4F475EA4; Mon, 16 Dec 2002 19:12:31 -0500 (EST) Received: from mx.smartnet.cz (unknown [193.165.185.50]) by postgresql.org (Postfix) with ESMTP id 0AC904758FE; Mon, 16 Dec 2002 19:12:30 -0500 (EST) Received: from kuba (helo=localhost) by mx.smartnet.cz with local-esmtp (Exim 3.35 #1 (Debian)) id 18O5LS-000618-00; Tue, 17 Dec 2002 01:12:22 +0100 Date: Tue, 17 Dec 2002 01:12:22 +0100 (CET) From: Jakub Ouhrabka X-X-Sender: kuba@server To: Robert Treat Cc: pgsql-sql@postgresql.org, "pgsql-general@postgresql.org" Subject: Re: working around setQuerySnapshot limitations in functions In-Reply-To: <1040055813.19398.49.camel@camel> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/795 X-Sequence-Number: 34710 Hi, I'm no expert on this but I think that some cases can be work around using foo updates instead of selects. See threads "LOCK TABLE oddness in PLpgSQL function called via JDBC" and "SetQuerySnapshot, once again" in the archives. But I think there is no general work around using only plpgsql. I'd also love to hear about one... HTH, kuba > I have a function called move_tree() which moves a node from 1 parent to > another (in a nested set tree) by computing some necessary values, then > updating the nodes as needed. The problem I have is that when the > function is called multiple times simultaneously, each function does a > setQuerySnapshot at the start of the function, and then cannot see the > changes made by the other function calls. I had thought to do a lock on > the table at the start of my function, but due to the fact > setQuerySnapshot is called at the function start (before I can acquire a > lock) I can't guarantee no changes have been made before the function > tries to make changes. ISTM the only way around this is to do a lock on > the table before calling the function. The major downside to that it > requires me to put that logic inside any apps that use the function, > rather than being able to keep it inside the database. Does anyone see > another work-around? > > Robert Treat > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >