469,106 Members | 2,338 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,106 developers. It's quick & easy.

Suppress output from function?

Whenever I run certain functions, such as the example below, the output
is either displayed in the terminal or emailed to be by cron, depending
on how I run it. Is there any way I can re-write the function, set some
psql parameters, etc, to ensure that the results aren't displayed? I've
checked some of the postgresql.conf logging properties and running psql
with quiet = true, but all to no avail. Anyone have any suggestions,
hints, ?

CREATE TYPE employeeType AS (empID INTEGER, updateDate DATE, bDate
INTEGER, val1 NUMERIC, val2 NUMERIC, val3 NUMERIC, val4 NUMERIC, favNum
NUMERIC);

CREATE OR REPLACE FUNCTION updateEmployeeData() RETURNS SETOF
employeeType AS '
DECLARE
rec RECORD;
BEGIN
FOR rec IN SELECT empID, updateDate, bDate, val1, val2 ,
val3, val4, favNum FROM newData LOOP
RETURN NEXT rec;
UPDATE currentData SET val1=rec.val1, val2=rec.val2,
val3=rec.val2, val4=rec.val4, favNum=rec.favNum, updateDate=rec.updateDate
WHERE empID=rec.empID;
END LOOP;
RETURN;
END;
' LANGUAGE 'plpgsql';

SELECT * FROM updateEmployeeData();
Thanks
Ron
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #1
1 1979
Ron St-Pierre <rs*******@syscor.com> writes:
Whenever I run certain functions, such as the example below, the output
is either displayed in the terminal or emailed to be by cron, depending
on how I run it. Is there any way I can re-write the function, set some
psql parameters, etc, to ensure that the results aren't displayed?


Add "> /dev/null" to the psql invocation in the cron script. You might
also want to add "-q" to suppress uninteresting comments on stderr,
while still hearing about any actual errors (in other words, I wouldn't
also route stderr to /dev/null...)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Eric Nelson | last post: by
9 posts views Thread by Doug Ly | last post: by
3 posts views Thread by Philipp Staempfli | last post: by
6 posts views Thread by Ron St-Pierre | last post: by
4 posts views Thread by nick | last post: by
5 posts views Thread by Luke Skywalker | last post: by
1 post views Thread by rn5a | last post: by
14 posts views Thread by fdu.xiaojf | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.