Question regarding FOUND
Greetings,
I have a question regarding the use of the FOUND variable within a plpgsql
function. I have a trigger fuction which executes a dynamic update on a
different table with the EXECUTE statement. Here's the question:
Will the FOUND variable be set, when using EXECUTE, as it would be with a
normal UPDATE statement?
Thanks for the input...
On Fri, Sep 02, 2005 at 08:51:41AM -0400, Terry Lee Tucker wrote:
Will the FOUND variable be set, when using EXECUTE, as it would be with a
normal UPDATE statement?
What happened when you tried it?
--
Michael Fuhr
I haven't tried it. It's a complicated trigger function with updates to other
tables that are NOT dynamic in nature. If the EXECUTE statement doesn't set
the FOUND variable, then I will be reading the result from a previous
operation. I thought maybe somebody would know this already.
On Friday 02 September 2005 09:14 am, Michael Fuhr saith:
Show quoted text
On Fri, Sep 02, 2005 at 08:51:41AM -0400, Terry Lee Tucker wrote:
Will the FOUND variable be set, when using EXECUTE, as it would be with a
normal UPDATE statement?What happened when you tried it?
--
Michael Fuhr
Apparently, the FOUND variable is set to false regardless of the outcome of
the dynamic update statement. I placed a call to GET DIAGNOSTICS var =
ROW_COUNT. It returned 1. Question is, was that the result of a direct
update previously coded in the same trigger, or is that the result of the
dynamic update statement performed with EXECUTE?
On Friday 02 September 2005 08:51 am, Terry Lee Tucker saith:
Greetings,
I have a question regarding the use of the FOUND variable within a plpgsql
function. I have a trigger fuction which executes a dynamic update on a
different table with the EXECUTE statement. Here's the question:Will the FOUND variable be set, when using EXECUTE, as it would be with a
normal UPDATE statement?Thanks for the input...
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
--
Quote: 87
"To those who cite the First Amendment as reason for excluding God
from more and more of our institutions every day, I say: The First
Amendment of the Constitution was not written to protect the people of
this country from religious values; it was written to protect
religious values from government tyranny."
--Ronald Reagan
Work: 1-336-372-6812
Cell: 1-336-363-4719
email: terry@esc1.com
Terry Lee Tucker <terry@esc1.com> writes:
Will the FOUND variable be set, when using EXECUTE, as it would be with a
normal UPDATE statement?
The documentation is pretty specific about which plpgsql statements set
FOUND, and I don't see EXECUTE in that list ...
http://developer.postgresql.org/docs/postgres/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS
regards, tom lane
I looked at the documentation before I ever posted anything. I didn't know how
EXECUTE works and I actually thought the UPDATE statement itself would set
the variable.
Thanks for the reply.
On Friday 02 September 2005 10:47 am, Tom Lane saith:
Show quoted text
Terry Lee Tucker <terry@esc1.com> writes:
Will the FOUND variable be set, when using EXECUTE, as it would be with a
normal UPDATE statement?The documentation is pretty specific about which plpgsql statements set
FOUND, and I don't see EXECUTE in that list ...
http://developer.postgresql.org/docs/postgres/plpgsql-statements.html#PLPGS
QL-STATEMENTS-DIAGNOSTICSregards, tom lane