pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed/* */ comments showing up in pg_stat_activity
8+ messages / 5 participants
[nested] [flat]
* /* */ comments showing up in pg_stat_activity
@ 2003-04-25 16:10 Rajesh Kumar Mallah <mallah@trade-india.com>
0 siblings, 1 reply; 8+ messages in thread
From: Rajesh Kumar Mallah @ 2003-04-25 16:10 UTC (permalink / raw)
To: pgsql-sql
Hmm ..
i just saw /* */ comments are being shown in current_query
is it ok ?
More importantly is it supposed to remain like that ?
In that case i can tag every query with some identifier
to know from which application it originated when i check
em in pg_stat_activity !
regds
mallah.
|
| 14655172 | tradein_clients | 5886 | 100 | tradein | /*
Inserting Branding Data
Expected Time: 5 mins
*/
INSERT into general.profile_master (userid, co_name, address, pincode, city,
country_code, phone_no, mobile, fax_no, email, website, title1, fname1,
mname1, lname1, desg1, title2, fname2, mname2, lname2, |
| 14655172 | tradein_clients | 3118 | 100 | tradein | <IDLE>
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-25 16:17 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Rajesh Kumar Mallah <mallah@trade-india.com>
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 2003-04-25 16:17 UTC (permalink / raw)
To: Rajesh Kumar Mallah <mallah@trade-india.com>; +Cc: pgsql-sql
Yes, we support /* */ comments.
---------------------------------------------------------------------------
Rajesh Kumar Mallah wrote:
>
>
>
> Hmm ..
> i just saw /* */ comments are being shown in current_query
> is it ok ?
>
> More importantly is it supposed to remain like that ?
> In that case i can tag every query with some identifier
> to know from which application it originated when i check
> em in pg_stat_activity !
>
>
> regds
> mallah.
>
> |
> | 14655172 | tradein_clients | 5886 | 100 | tradein | /*
> Inserting Branding Data
> Expected Time: 5 mins
> */
> INSERT into general.profile_master (userid, co_name, address, pincode, city,
> country_code, phone_no, mobile, fax_no, email, website, title1, fname1,
> mname1, lname1, desg1, title2, fname2, mname2, lname2, |
> | 14655172 | tradein_clients | 3118 | 100 | tradein | <IDLE>
>
>
>
> --
> Rajesh Kumar Mallah,
> Project Manager (Development)
> Infocom Network Limited, New Delhi
> phone: +91(11)6152172 (221) (L) ,9811255597 (M)
>
> Visit http://www.trade-india.com ,
> India's Leading B2B eMarketplace.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-26 02:47 Jan Wieck <JanWieck@Yahoo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 8+ messages in thread
From: Jan Wieck @ 2003-04-26 02:47 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Rajesh Kumar Mallah <mallah@trade-india.com>; pgsql-sql
We do, but that wasn't the question.
I think you can asume that it'll stay that way because it is part of the
query string the backend is currently chewing on. What shows up in
pg_stat_activity is whatever was in the received query buffer before
starting to parse it. So we would have a hard time at that point to
filter out the comments.
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. If you're using libpq or another API that is
basically a libpq wrapper, you're pretty safe.
Jan
Bruce Momjian wrote:
>
> Yes, we support /* */ comments.
>
> ---------------------------------------------------------------------------
>
> Rajesh Kumar Mallah wrote:
> >
> >
> >
> > Hmm ..
> > i just saw /* */ comments are being shown in current_query
> > is it ok ?
> >
> > More importantly is it supposed to remain like that ?
> > In that case i can tag every query with some identifier
> > to know from which application it originated when i check
> > em in pg_stat_activity !
> >
> >
> > regds
> > mallah.
>
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-26 03:05 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jan Wieck <JanWieck@Yahoo.com>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2003-04-26 03:05 UTC (permalink / raw)
To: Jan Wieck <JanWieck@Yahoo.com>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; Rajesh Kumar Mallah <mallah@trade-india.com>; pgsql-sql
Jan Wieck <JanWieck@Yahoo.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.
psql already does strip comments (and always has, AFAIK).
> If you're using libpq or another API that is
> basically a libpq wrapper, you're pretty safe.
Agreed, I doubt we'd ever bother to put comment-stripping logic in libpq.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-26 04:48 Rajesh Kumar Mallah <mallah@trade-india.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 8+ messages in thread
From: Rajesh Kumar Mallah @ 2003-04-26 04:48 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql
On Saturday 26 Apr 2003 8:35 am, Tom Lane wrote:
> Jan Wieck <JanWieck@Yahoo.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.
Regds
Mallah.
>
> psql already does strip comments (and always has, AFAIK).
>
> > If you're using libpq or another API that is
> > basically a libpq wrapper, you're pretty safe.
>
> Agreed, I doubt we'd ever bother to put comment-stripping logic in libpq.
>
> regards, tom lane
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-26 14:05 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Rajesh Kumar Mallah <mallah@trade-india.com>
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 2003-04-26 14:05 UTC (permalink / raw)
To: Rajesh Kumar Mallah <mallah@trade-india.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql
Rajesh Kumar Mallah wrote:
> On Saturday 26 Apr 2003 8:35 am, Tom Lane wrote:
> > Jan Wieck <JanWieck@Yahoo.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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-26 16:37 Rajesh Kumar Mallah <rmallah@trade-india.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 8+ messages in thread
From: Rajesh Kumar Mallah @ 2003-04-26 16:37 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Rajesh Kumar Mallah <mallah@trade-india.com>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql
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 <JanWieck@Yahoo.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. :-) ]
>
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*> */
>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: /* */ comments showing up in pg_stat_activity
@ 2003-04-28 22:19 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Rajesh Kumar Mallah <rmallah@trade-india.com>
0 siblings, 0 replies; 8+ messages in thread
From: Bruce Momjian @ 2003-04-28 22:19 UTC (permalink / raw)
To: Rajesh Kumar Mallah <rmallah@trade-india.com>; +Cc: Rajesh Kumar Mallah <mallah@trade-india.com>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql
Rajesh Kumar Mallah wrote:
> 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.
I think you have to look try perl to see how it handles it, but I think
it just passes the query whole, so all the comments should pass
themselves to the backend.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2003-04-28 22:19 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-25 16:10 /* */ comments showing up in pg_stat_activity Rajesh Kumar Mallah <mallah@trade-india.com>
2003-04-25 16:17 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-04-26 02:47 ` Jan Wieck <JanWieck@Yahoo.com>
2003-04-26 03:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-04-26 04:48 ` Rajesh Kumar Mallah <mallah@trade-india.com>
2003-04-26 14:05 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-04-26 16:37 ` Rajesh Kumar Mallah <rmallah@trade-india.com>
2003-04-28 22:19 ` Bruce Momjian <pgman@candle.pha.pa.us>
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