X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97A003A48F1 for ; Thu, 4 Nov 2004 17:20:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42889-07 for ; Thu, 4 Nov 2004 17:20:11 +0000 (GMT) Received: from fe06.axelero.hu (fe06.axelero.hu [195.228.240.94]) by svr1.postgresql.org (Postfix) with ESMTP id 8AAC73A48E6 for ; Thu, 4 Nov 2004 17:20:10 +0000 (GMT) Received: from fe06 (localhost-02 [127.0.2.1]) by fe06.axelero.hu (8.12.11/8.12.11) with SMTP id iA4HK8mN004467 for ; Thu, 4 Nov 2004 18:20:08 +0100 (CET) Received: from fe06.axelero.hu [127.0.2.1] via SMTP gateway by fe06 [195.228.240.94]; id A01169B89B3 at Thu, 04 Nov 2004 18:20:07 +0100 Received: from fejleszt4 (121-248-182-81.adsl-fixip.axelero.hu [81.182.248.121]) by fe06.axelero.hu (8.12.11/8.12.11) with SMTP id iA4HK6E5004440 for ; Thu, 4 Nov 2004 18:20:07 +0100 (CET) Message-ID: <012601c4c292$6804b810$0403a8c0@fejleszt4> From: =?iso-8859-2?B?U1rbQ1MgR+Fib3I=?= To: Subject: Delayed result from another connection Date: Thu, 4 Nov 2004 18:19:13 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-RAVMilter-Version: 8.4.3(snapshot 20030217) (fe06.axelero.hu) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/35 X-Sequence-Number: 19354 Dear Gurus, I have a strange scenario that doesn't seem to work flawlessly. I think I can produce a full working example if needed. We use postgresql 7.4.5 It's something like this: %----------------------- cut here -----------------------% CREATE TABLE php_retval(id serial PRIMARY KEY, retval varchar); CREATE FUNCTION php_run(int, varchar) RETURNS varchar AS ' declare seq ALIAS FOR $1; php ALIAS FOR $2; ret varchar; begin perform php_run_c(php, seq); ret := retval from php_retval where id = seq; return ret; end;' LANGUAGE 'plpgsql' VOLATILE STRICT; %----------------------- cut here -----------------------% Now, this calls a c (SPI) function that calls system() to execute "php -q" The php connects to the database and updates retval where id=seq. It seems to be OK, but the function returns the value of php_retval.retval _before_ the call. However, the php does the update. If I repeat the function call in the transaction, the new result is returned: %----------------------- cut here -----------------------% UPDATE php_retval SET retval='nothing' WHERE id=1; BEGIN; SELECT php_run(1, 'test.php'); --> 'nothing' SELECT php_run(1, 'test.php'); --> '3', the right value END; %----------------------- cut here -----------------------% I thought it's something about "35.2 Visibility of Data Changes", but that's only for triggers, isn't it? Also, the rule "query sees results of any previously started queries" seems to be invaded: the perform runs right before the query for retval. Any ideas, explanations, clarifications, points to earlier discussions, rtfm etc? TIA, G. %----------------------- cut here -----------------------% \end