Re: Function return number of affected rows - Mailing list pgsql-interfaces

From Francisco Figueiredo Jr.
Subject Re: Function return number of affected rows
Date
Msg-id 420FF3D8.1050301@yahoo.com.br
Whole thread Raw
In response to Re: Function return number of affected rows  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-interfaces
-----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-----



pgsql-interfaces by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: How to write UDF in C that resemble the LIKE function
Next
From: b t
Date:
Subject: Question Regarding "fuzzystrmatch" How to find it in Cygwin?