X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 70A69D1BA8F for ; Thu, 4 Mar 2004 21:35:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55809-06 for ; Thu, 4 Mar 2004 17:35:05 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 239C7D1B4E4 for ; Thu, 4 Mar 2004 17:35:03 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i24LZ1Oe028983; Thu, 4 Mar 2004 16:35:01 -0500 (EST) To: gry@ll.mit.edu Cc: pgsql-sql@postgresql.org Subject: Re: debugging query to put message in pg logfile? In-reply-to: <20040304153219.210f3648.gry@ll.mit.edu> References: <20040304153219.210f3648.gry@ll.mit.edu> Comments: In-reply-to george young message dated "Thu, 04 Mar 2004 15:32:19 -0500" Date: Thu, 04 Mar 2004 16:35:01 -0500 Message-ID: <28982.1078436101@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/42 X-Sequence-Number: 17141 george young 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