pgsql: Implement current_query(), that shows the currently executing

Lists: pgsql-committerspgsql-hackers
From: momjian(at)postgresql(dot)org (Bruce Momjian)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-04 16:57:21
Message-ID: 20080404165721.EF3E37558F0@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Implement current_query(), that shows the currently executing query.
At the same time remove dblink/dblink_current_query() as it is no longer
necessary
*BACKWARD COMPATIBILITY ISSUE* for dblink

Tomas Doran

Modified Files:
--------------
pgsql/contrib/dblink:
dblink.c (r1.71 -> r1.72)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/dblink.c?r1=1.71&r2=1.72)
dblink.h (r1.19 -> r1.20)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/dblink.h?r1=1.19&r2=1.20)
dblink.sql.in (r1.14 -> r1.15)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/dblink.sql.in?r1=1.14&r2=1.15)
uninstall_dblink.sql (r1.5 -> r1.6)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/uninstall_dblink.sql?r1=1.5&r2=1.6)
pgsql/contrib/dblink/expected:
dblink.out (r1.21 -> r1.22)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/expected/dblink.out?r1=1.21&r2=1.22)
pgsql/contrib/dblink/sql:
dblink.sql (r1.18 -> r1.19)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/sql/dblink.sql?r1=1.18&r2=1.19)
pgsql/doc/src/sgml:
dblink.sgml (r1.3 -> r1.4)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/dblink.sgml?r1=1.3&r2=1.4)
func.sgml (r1.425 -> r1.426)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml?r1=1.425&r2=1.426)
pgsql/src/backend/utils/adt:
misc.c (r1.58 -> r1.59)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/misc.c?r1=1.58&r2=1.59)
pgsql/src/include/catalog:
pg_proc.h (r1.485 -> r1.486)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h?r1=1.485&r2=1.486)
pgsql/src/include/utils:
builtins.h (r1.310 -> r1.311)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h?r1=1.310&r2=1.311)


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <momjian(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-04 18:39:42
Message-ID: 20080404183942.GF12346@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Bruce Momjian wrote:
> Log Message:
> -----------
> Implement current_query(), that shows the currently executing query.
> At the same time remove dblink/dblink_current_query() as it is no longer
> necessary
> *BACKWARD COMPATIBILITY ISSUE* for dblink

I think the agreement was that dblink_current_query was to be
implemented on top of this. In fact I don't see any reason not to.

Also, wasn't the name supposed to be client_query?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-04 19:05:05
Message-ID: 200804041905.m34J55t13168@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > Log Message:
> > -----------
> > Implement current_query(), that shows the currently executing query.
> > At the same time remove dblink/dblink_current_query() as it is no longer
> > necessary
> > *BACKWARD COMPATIBILITY ISSUE* for dblink
>
> I think the agreement was that dblink_current_query was to be
> implemented on top of this. In fact I don't see any reason not to.

Really? It seemed like just duplicate functionality.

> Also, wasn't the name supposed to be client_query?

Because pg_stat_activity already has current_query (and no one has
complained about it) there was discussion to just make it current_query.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-04 19:11:06
Message-ID: 20080404191106.GH12346@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Bruce Momjian wrote:
> Alvaro Herrera wrote:

> > I think the agreement was that dblink_current_query was to be
> > implemented on top of this. In fact I don't see any reason not to.
>
> Really? It seemed like just duplicate functionality.

It's called "backwards compatibility". The nice thing about it is that
it doesn't cost us any extra code.

> > Also, wasn't the name supposed to be client_query?
>
> Because pg_stat_activity already has current_query (and no one has
> complained about it) there was discussion to just make it current_query.

I don't think you can call that an agreement. It was just a suggestion
IIRC.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 00:40:26
Message-ID: 11600.1207356026@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Bruce Momjian wrote:
>> Alvaro Herrera wrote:
>>> I think the agreement was that dblink_current_query was to be
>>> implemented on top of this. In fact I don't see any reason not to.
>>
>> Really? It seemed like just duplicate functionality.

> It's called "backwards compatibility". The nice thing about it is that
> it doesn't cost us any extra code.

Indeed. It's just silly to break dblink users when there's no need.

>>> Also, wasn't the name supposed to be client_query?
>>
>> Because pg_stat_activity already has current_query (and no one has
>> complained about it) there was discussion to just make it current_query.

> I don't think you can call that an agreement. It was just a suggestion
> IIRC.

Well, there wasn't any strong consensus for client_query either ...

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 00:47:26
Message-ID: 200804050047.m350lQX20752@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > Bruce Momjian wrote:
> >> Alvaro Herrera wrote:
> >>> I think the agreement was that dblink_current_query was to be
> >>> implemented on top of this. In fact I don't see any reason not to.
> >>
> >> Really? It seemed like just duplicate functionality.
>
> > It's called "backwards compatibility". The nice thing about it is that
> > it doesn't cost us any extra code.
>
> Indeed. It's just silly to break dblink users when there's no need.

OK. Did someone mention this before because I don't remember it and the
patch removed the dblink usage. Do we continue to document the
function?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 01:39:15
Message-ID: 20080405013915.GB29452@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Bruce Momjian wrote:

> > >> Alvaro Herrera wrote:
> > >>> I think the agreement was that dblink_current_query was to be
> > >>> implemented on top of this. In fact I don't see any reason not to.

> OK. Did someone mention this before because I don't remember it and the
> patch removed the dblink usage. Do we continue to document the
> function?

Yes, I did:

http://archives.postgresql.org/pgsql-patches/2007-05/msg00098.php

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, bobtfish(at)bobtfish(dot)net
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 01:46:05
Message-ID: 200804050146.m351k5V18056@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera wrote:
> Bruce Momjian wrote:
>
> > > >> Alvaro Herrera wrote:
> > > >>> I think the agreement was that dblink_current_query was to be
> > > >>> implemented on top of this. In fact I don't see any reason not to.
>
> > OK. Did someone mention this before because I don't remember it and the
> > patch removed the dblink usage. Do we continue to document the
> > function?
>
> Yes, I did:
>
> http://archives.postgresql.org/pgsql-patches/2007-05/msg00098.php

I see what happened. The author said he had made the change, but the
patch didn't contain it:

http://archives.postgresql.org/pgsql-patches/2007-05/msg00132.php
> > FWIW I think you should still provide dblink_current_query, even if it's
> >
> > only a wrapper over current_query(), for backwards compatibility.
>
> Good point. Done as suggested (I think, or did you mean also the change
> of instances to use current_query()?). Replaced dblink_current_query
> with an SQL procedure wrapper, I assume that's the most efficient way of
> doing it?

So do we document it or just add a function entry point?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: bobtfish(at)bobtfish(dot)net
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 02:37:38
Message-ID: 200804050237.m352bca01251@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Bruce Momjian wrote:
> I see what happened. The author said he had made the change, but the
> patch didn't contain it:
>
> http://archives.postgresql.org/pgsql-patches/2007-05/msg00132.php
> > > FWIW I think you should still provide dblink_current_query, even if it's
> > >
> > > only a wrapper over current_query(), for backwards compatibility.
> >
> > Good point. Done as suggested (I think, or did you mean also the change
> > of instances to use current_query()?). Replaced dblink_current_query
> > with an SQL procedure wrapper, I assume that's the most efficient way of
> > doing it?

I have re-added it as an undocumented dblink SQL function.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 1.4 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: bobtfish(at)bobtfish(dot)net, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 02:41:23
Message-ID: 27619.1207363283@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> + CREATE OR REPLACE FUNCTION dblink_current_query ()
> + RETURNS text
> + AS 'SELECT current_query()'
> + LANGUAGE SQL;

Needs to be pg_catalog.current_query

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: bobtfish(at)bobtfish(dot)net, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Implement current_query(), that shows the currently executing
Date: 2008-04-05 02:44:52
Message-ID: 200804050244.m352iq106222@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > + CREATE OR REPLACE FUNCTION dblink_current_query ()
> > + RETURNS text
> > + AS 'SELECT current_query()'
> > + LANGUAGE SQL;
>
> Needs to be pg_catalog.current_query

Oh, good point. Done.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +