From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | gry(at)ll(dot)mit(dot)edu |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: debugging query to put message in pg logfile? |
Date: | 2004-03-04 21:35:01 |
Message-ID: | 28982.1078436101@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
george young <gry(at)ll(dot)mit(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | george young | 2004-03-05 15:23:45 | Re: debugging query to put message in pg logfile? |
Previous Message | Tom Lane | 2004-03-04 21:15:50 | Re: query optimization |