473,748 Members | 2,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Suppress output from psql?

Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).

Thanks
Ron
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
6 7016
Ron St-Pierre <rs*******@sysc or.com> writes:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).


How about putting ">/dev/null 2>&1" after the command line in your crontab?

Or redirect it to a file if you think you might need it...

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #2
Ron St-Pierre <rs*******@sysc or.com> writes:
Is there a way 'within' psql to suppress output?


Perhaps "\o /dev/null" ?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
You could redirect the output from your cron initiated script with:
/dev/null 2>&1
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various
database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined
functions.
So within this sql file there are various SELECT * FROM myFunction();
which
sends output to the user from cron. I can't see anyway to suppress
this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).

Thanks
Ron
---------------------------(end of
broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #4
On Tue, Aug 31, 2004 at 09:00:24PM -0400, Doug McNaught wrote:
Ron St-Pierre <rs*******@sysc or.com> writes:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).
How about putting ">/dev/null 2>&1" after the command line in your crontab?


This is a bad idea if the command fails ...
Or redirect it to a file if you think you might need it...


Yeah, redirect it to a temp file (use mktemp) and

if [ $? == 0 ]; then
delete the file
else
cat the file
fi

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El Maquinismo fue proscrito so pena de cosquilleo hasta la muerte"
(Ijon Tichy en Viajes, Stanislaw Lem)
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #5
Checkout http://www.hentzenwerke.com/wp/cron_explained.pdf

Look for the MAILTO="" command which you can use to suppress the mailing
of cron job output.

And try redirecting std output to /dev/null, and/or send the output from
psql to a file.

John Sidney-Woollett

Ron St-Pierre wrote:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this
from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).

Thanks
Ron
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #6
Ron St-Pierre wrote:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction();
which
sends output to the user from cron. I can't see anyway to suppress
this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).


Tom, that looks like exactly what I need, I'll try it. Doug, Scott,
Alvaro, John, I don't want to send the entire output
of my cron script to /dev/null, just the parts inside of my misc.sql
file (which cron calls) where I call my own functions,
eg SELECT * FROM myFunction();

Also. I will check out the MAILTO="" which will be helpful for some of
my other cron scripts. Thanks John.

Ron
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
12344
by: Daniel Schuchardt | last post by:
Hi @ all, i'm sure there was a psql-function to transfere my Blob-Data to the server but I can't remember. I have a script like this : UPDATE xy SET z = lo_import('localpath_and_file'); but i want to execute this script from the client and so my blob-data is
3
12416
by: Philipp Staempfli | last post by:
Hello I have a project which includes different libraries. When I compile the project, I get a huge amount of the following linker warnings: --- warning LNK4204: "C:\...\Debug\vc70.pdb' is missing debugging information for referencing module; linking object as if no debug info --- I'd like to suppress these warnings and therefor I tried to include a "/ignore 4204" in "Property->Linker->Command Line", unfortunatly
3
21397
by: Russ Schneider | last post by:
Is there an easy way to pipe a select statement's output to a file? -- http://www.sugapablo.com <--music ] http://www.sugapablo.net <--personal ] sugapablo@12jabber.com <--jabber IM ] ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
1
2323
by: Ron St-Pierre | last post by:
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, ? ...
1
1557
by: Vinay Jain | last post by:
If we have aligned output enabled in psql...the output is aligned on basis of the maximum length of data being displyed...is it true?? how this thing is coded and where (in which file) I am using postgresql 7.4.2. Regards Vinay -- Vinay Jain
1
2191
by: Josué Maldonado | last post by:
Hello List, I'm having this issue with beta 8.0 C:\pgsql\bin>pg_dump -U postgres farmacia > xfar.sql Password: C:\pgsql\bin>psql -U postgres farmacia2 < xfar.sql Password: psql: FATAL: Password authentication failed for user "postgres" C:\pgsql\bin>psql -U postgres -W farmacia2 < xfar.sql
6
1352
by: Jerome Lyles | last post by:
I have a small training database: sql_tutorial. It works fine but the spacing between the output lines is too much. This is the way it looks when I copy and paste from the Konsole to this email: sql_tutorial=> SELECT prod_name FROM Products; prod_name...
1
1615
by: rn5a | last post by:
A custom server control has a Button. Namespace Confirm Public Class ShowConfirm : Inherits Button Private strConfirmMsg As String Public Property ConfirmMessage() As String Get ConfirmMessage = strConfirmMsg End Get Set(ByVal value As String)
14
1775
by: fdu.xiaojf | last post by:
Hi, I'm writing a program which imports an external module writing in C and calls a function provided by the module to do my job. But the method produces a lot of output to the stdout, and this consumes most of the running time. My question is, is there a way to depress the output produced by the function and hence make my program run faster? It's too complicated for me to modify the source code and recompile the external module.
0
8979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8818
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9522
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9355
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9307
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.