From: Tom Lane <tgl@sss.pgh.pa.us>
To: Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
Cc: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Function return number of affected rows
Date: Sat, 12 Feb 2005 14:08:00 -0500
Message-ID: <22824.1108235280@sss.pgh.pa.us> (raw)
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>
"Francisco Figueiredo Jr." <fxjrlists@yahoo.com.br> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, fxjrlists@yahoo.com.br, mike@fuhr.org
Subject: Re: Function return number of affected rows
In-Reply-To: <22824.1108235280@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox