X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E3538BA09D for ; Mon, 14 Feb 2005 00:08:28 +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 47322-10 for ; Mon, 14 Feb 2005 00:08:21 +0000 (GMT) Received: from smtp209.mail.sc5.yahoo.com (smtp209.mail.sc5.yahoo.com [216.136.130.117]) by svr1.postgresql.org (Postfix) with SMTP id E4C588B9ED8 for ; Mon, 14 Feb 2005 00:08:19 +0000 (GMT) Received: from unknown (HELO ?192.168.200.87?) (fxjrlists@200.140.14.165 with plain) by smtp209.mail.sc5.yahoo.com with SMTP; 14 Feb 2005 00:08:18 -0000 Message-ID: <420FF3D8.1050301@yahoo.com.br> Date: Sun, 13 Feb 2005 22:42:00 -0200 From: "Francisco Figueiredo Jr." User-Agent: Mozilla Thunderbird 0.8 (X11/20041022) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: Re: Function return number of affected rows References: <420B46AC.9080002@yahoo.com.br> <20050210144654.GB68483@winnie.fuhr.org> <420B9122.2090802@yahoo.com.br> <20050210221505.GA73565@winnie.fuhr.org> <420E4E10.6090104@yahoo.com.br> <22824.1108235280@sss.pgh.pa.us> In-Reply-To: <22824.1108235280@sss.pgh.pa.us> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.771 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, RCVD_IN_NJABL_PROXY X-Spam-Level: X-Archive-Number: 200502/54 X-Sequence-Number: 5299 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tom Lane wrote: | "Francisco Figueiredo Jr." writes: | |>But if I create a function like: | | |>create function inserttest() returns void as ' insert into table1 |>values(1, 1)' language 'sql'; | | |>and I do a select * from inserttest(); | | |>I can't get the CompletedResponse saying one row was affected :( | | | Why should you? What you executed was a SELECT. What the function does | internally is no business of yours. | Hi Tom. Ok. That was what I thougth too. But I just wanted to be sure I wasn't missing anything. | You could define the function as returning the information you would | like to have the client app know. I don't think there is any way to get | at the rowcount in a SQL-language function, but most of the PL languages | have a mechanism for it, e.g. GET DIAGNOSTICS integer_var = ROW_COUNT; | in plpgsql. | Yeap, that was one of the answers I got. I thought there could be some other way without modifying the function. I was asking that because I received a lot of requests of being able to get the number of rows affected by an executing function. And so I came here because I didn't see anything in protocol which could be used. Thanks for feedback Tom. - -- Regards, Francisco Figueiredo Jr. Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member http://monobrasil.softwarelivre.org - ------------- "Science without religion is lame; religion without science is blind." ~ ~ Albert Einstein -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iQEVAwUBQg/z2P7iFmsNzeXfAQLPZAf/X1XBjDEEbIQ8oglHj/WKM+wCC6gnv7B9 ntXphAlMtDYQYvhVx0zht7zIy2sN3R31BeH254kk7rDyK68ssVc5G2Q4jX0zd0rx 2aedkk7M3hJlpO7/VK6QLJksZvBU8vYbjw5/UmC+uPfygjzkpV5UR+OSYRI9jrt1 Zr/Ce9C87IME52SwM5Tw4sFUTG1ogtFgnSLeuXw/jGhqweB3iBNBtdG4skd49ZRs GIg/StcZX92SOjiUF8eywMAFB5ar78tjJFLSgruHvO8JfeD0gtThBYDf5lclNImF rNNO4ql9Oe/2lfDiS9HFzVvz22hJ1OVF9AA+UoSEhWxVZWw2aMgzzQ== =RNmi -----END PGP SIGNATURE-----