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 2DB2A8B9EBA for ; Sat, 12 Feb 2005 19:08:06 +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 01190-01 for ; Sat, 12 Feb 2005 19:08:04 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D3BFF8B9EAE for ; Sat, 12 Feb 2005 19:08:01 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1CJ80Qr022825; Sat, 12 Feb 2005 14:08:00 -0500 (EST) To: "Francisco Figueiredo Jr." Cc: Michael Fuhr , pgsql-interfaces@postgresql.org Subject: Re: Function return number of affected rows In-reply-to: <420E4E10.6090104@yahoo.com.br> 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> Comments: In-reply-to "Francisco Figueiredo Jr." message dated "Sat, 12 Feb 2005 16:42:24 -0200" Date: Sat, 12 Feb 2005 14:08:00 -0500 Message-ID: <22824.1108235280@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/48 X-Sequence-Number: 5293 "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. 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. regards, tom lane