X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9B0CB474E4F for ; Sat, 26 Apr 2003 12:37:19 -0400 (EDT) Received: from trade-india.com (ns5.trade-india.com [66.234.10.13]) by postgresql.org (Postfix) with SMTP id CB8DB474E42 for ; Sat, 26 Apr 2003 12:37:18 -0400 (EDT) Received: (qmail 32658 invoked by uid 505); 26 Apr 2003 16:37:24 -0000 Received: from rmallah@trade-india.com by ns5.trade-india.com by uid 502 with qmail-scanner-1.15 (uvscan: v4.1.60/v4171. Clear:. Processed in 1.569697 secs); 26 Apr 2003 16:37:24 -0000 Received: from unknown (HELO ?219.65.253.134?) (219.65.253.134) by ns5.trade-india.com with SMTP; 26 Apr 2003 16:37:22 -0000 Date: Sat, 26 Apr 2003 22:07:14 +0530 (IST) From: Rajesh Kumar Mallah X-X-Sender: To: Bruce Momjian Cc: Rajesh Kumar Mallah , Tom Lane , Subject: Re: /* */ comments showing up in pg_stat_activity In-Reply-To: <200304261405.h3QE55W19202@candle.pha.pa.us> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-31.7 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES,USER_AGENT_PINE autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/446 X-Sequence-Number: 13147 On Sat, 26 Apr 2003, Bruce Momjian wrote: > Rajesh Kumar Mallah wrote: > > On Saturday 26 Apr 2003 8:35 am, Tom Lane wrote: > > > Jan Wieck writes: > > > > The question back is from where does such a query with a comment come? > > > > If it is a standard client like psql, it could happen someday that this > > > > client does some filtering. > > > > > > Yes its thru psql only , i run a SQL batch using > > psql -e -h db -f batch.sql > > > > In case future version of psql strips them it would > > still be nice if libpq continue supporting it > > i feel it would be a nice feature for keeping track of > > queries. > > [ After not replying to the proper question before, I will try again. :-) ] > Thanks Bruce, But if i were to use DBD::Perl (which probably uses libpq) is it safe to pass query indentifier in comments which u said are not stripped by psql eg /* AppName: Xyzt */ Select foo from bar where cw='t' ; for years to come ? why i ask is that i was always curious of the slow long running queries in pg_stat_activity and not able to figure out the source had frustrated me , now this method if it works seems to me as a viable solution. regds mallah. > The actual stripping of comments in psql is a little more complex. For > example, this will not strip: > > SELECT /* test */ 1; > > while this will strip comments: > > SELECT 1; /* test */ > > and leading comments are not stripped either: > > /* test */ SELECT 1; > > so if the comment is _inside_ a query, it will be OK, but outside and > trailing, psql processes the comment itself so it can display the proper > prompting: > > test=> /* > test*> test > > ^ > test*> */ > >