pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
To: pgsql-interfaces@postgresql.org
Subject: Re: Function return number of affected rows
Date: Sun, 13 Feb 2005 22:42:00 -0200
Message-ID: <420FF3D8.1050301@yahoo.com.br> (raw)
In-Reply-To: <22824.1108235280@sss.pgh.pa.us>
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>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Lane wrote:
| "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.
|

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-----




view thread (7+ messages)

Message-ID: <420FF3D8.1050301@yahoo.com.br>
Permalink:  ../420FF3D8.1050301@yahoo.com.br/
Also on:    postgresql.org/message-id/420FF3D8.1050301@yahoo.com.br

 · 

reply

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: fxjrlists@yahoo.com.br
  Subject: Re: Function return number of affected rows
  In-Reply-To: <420FF3D8.1050301@yahoo.com.br>

* 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