Re: /* */ comments showing up in pg_stat_activity

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org
Subject: Re: /* */ comments showing up in pg_stat_activity
Date: 2003-04-26 14:05:05
Message-ID: 200304261405.h3QE55W19202@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rajesh Kumar Mallah wrote:
> On Saturday 26 Apr 2003 8:35 am, Tom Lane wrote:
> > Jan Wieck <JanWieck(at)Yahoo(dot)com> 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. :-) ]

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*> */

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-04-26 16:37:14 Re: /* */ comments showing up in pg_stat_activity
Previous Message Troy 2003-04-26 13:07:04 Re: Fwd: Unicode, RedHat Linux, & PostgreSQL