pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: gry@ll.mit.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: debugging query to put message in pg logfile?
Date: Thu, 04 Mar 2004 16:35:01 -0500
Message-ID: <28982.1078436101@sss.pgh.pa.us> (raw)
In-Reply-To: <20040304153219.210f3648.gry@ll.mit.edu>
References: <20040304153219.210f3648.gry@ll.mit.edu>

george young <gry@ll.mit.edu> writes:
> I've started putting debugging queries like:
>    select "opwin.py: committing step signoff"
> in my app, just to have an entry in the postgres logfile.

> Is there some cheaper (or more appropriate) sql statement that will show
> up in the postgres log?

You could just send SQL comments:

	-- opwin.py: committing step signoff

One advantage of this is that you can merge the comments with actual
commands, thus not incurring even a network round-trip time for them.
If you do send it separately, it will act like an empty query string.

People tend not to think of this because psql strips -- comments before
sending commands.  But I believe all the lower-level libraries will pass
them through.  (If you need to pass loggable comments through psql, I
think the /* ... */ form will work.)

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <28982.1078436101@sss.pgh.pa.us>
Permalink:  ../28982.1078436101@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28982.1078436101@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gry@ll.mit.edu
  Subject: Re: debugging query to put message in pg logfile?
  In-Reply-To: <28982.1078436101@sss.pgh.pa.us>

* 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