Thread: Query truncated in Server Status

Query truncated in Server Status

From
Aren Cambre
Date:
In the Server Status program, long queries get truncated.

Pressing Ctrl-C or the Copy button on a recent query put this in the clipboard:
9368 de 34132 postgres 6/528 AccessShareLock Yes 2012-02-18 18:46:14.759-06 select distinct case when upper(geometrytype("the_geom")) IN ('POINT','MULTIPOINT') THEN 'POINT' when upper(geometrytype("the_geom")) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when upper(geometrytype("the_geom")) IN ('POLYGON','MULTIPOLYG

Looks like the query got truncated at the 250th character. I've reproduced on other queries.

I'm OK if the query needs to be truncated to fit in the UI, but the whole query ought to be copied to the clipboard. This is making it challenging for me to analyze a problematic Quantum GIS query.

Aren Cambre

Re: Query truncated in Server Status

From
Aren Cambre
Date:
Hmm, the magical number is not 250 characters. This query got truncated at character 374:
8640 Quantum GIS de postgres ::1:60281 2012-02-18 18:56:15.869-06 2012-02-18 18:56:15.893-06 2012-02-18 18:56:15.893-06 select distinct case when upper(geometrytype("the_geom")) IN ('POINT','MULTIPOINT') THEN 'POINT' when upper(geometrytype("the_geom")) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when upper(geometrytype("the_geom")) IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON' end from (select "the_geom" from "raw"."dallas_rlc_summary" where "the_geom" is not null limit 100) as t

On Sat, Feb 18, 2012 at 6:54 PM, Aren Cambre <aren@arencambre.com> wrote:
In the Server Status program, long queries get truncated.

Pressing Ctrl-C or the Copy button on a recent query put this in the clipboard:
9368 de 34132 postgres 6/528 AccessShareLock Yes 2012-02-18 18:46:14.759-06 select distinct case when upper(geometrytype("the_geom")) IN ('POINT','MULTIPOINT') THEN 'POINT' when upper(geometrytype("the_geom")) IN ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when upper(geometrytype("the_geom")) IN ('POLYGON','MULTIPOLYG

Looks like the query got truncated at the 250th character. I've reproduced on other queries.

I'm OK if the query needs to be truncated to fit in the UI, but the whole query ought to be copied to the clipboard. This is making it challenging for me to analyze a problematic Quantum GIS query.

Aren Cambre

Re: Query truncated in Server Status

From
Guillaume Lelarge
Date:
On Sat, 2012-02-18 at 18:54 -0600, Aren Cambre wrote:
> In the Server Status program, long queries get truncated.
> 
> Pressing Ctrl-C or the *Copy* button on a recent query put this in the
> clipboard:
> *9368 de 34132 postgres 6/528 AccessShareLock Yes 2012-02-18
> 18:46:14.759-06 select
> distinct case when upper(geometrytype("the_geom")) IN
> ('POINT','MULTIPOINT') THEN 'POINT' when upper(geometrytype("the_geom")) IN
> ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when
> upper(geometrytype("the_geom")) IN ('POLYGON','MULTIPOLYG*
> *
> *
> Looks like the query got truncated at the 250th character. I've reproduced
> on other queries.
> 
> I'm OK if the query needs to be truncated to fit in the UI, but the whole
> query ought to be copied to the clipboard. This is making it challenging
> for me to analyze a problematic Quantum GIS query.
> 

I suppose you work on Windows. The widget we use on Windows truncates
silently all strings to 512 characters. It means we need to fix this
(just as we did for the table properties dialog which suffered the same
issue).

To be complete, you have to know that even PostgreSQL truncates the
query in the pg_stat_activity stats catalog. By default to 1024
characters. So if your queries are longer than that, there's nothing we
can do.

Working on a fix right now.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Query truncated in Server Status

From
Guillaume Lelarge
Date:
On Sun, 2012-02-19 at 10:23 +0100, Guillaume Lelarge wrote:
> On Sat, 2012-02-18 at 18:54 -0600, Aren Cambre wrote:
> > In the Server Status program, long queries get truncated.
> > 
> > Pressing Ctrl-C or the *Copy* button on a recent query put this in the
> > clipboard:
> > *9368 de 34132 postgres 6/528 AccessShareLock Yes 2012-02-18
> > 18:46:14.759-06 select
> > distinct case when upper(geometrytype("the_geom")) IN
> > ('POINT','MULTIPOINT') THEN 'POINT' when upper(geometrytype("the_geom")) IN
> > ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when
> > upper(geometrytype("the_geom")) IN ('POLYGON','MULTIPOLYG*
> > *
> > *
> > Looks like the query got truncated at the 250th character. I've reproduced
> > on other queries.
> > 
> > I'm OK if the query needs to be truncated to fit in the UI, but the whole
> > query ought to be copied to the clipboard. This is making it challenging
> > for me to analyze a problematic Quantum GIS query.
> > 
> 
> I suppose you work on Windows. The widget we use on Windows truncates
> silently all strings to 512 characters. It means we need to fix this
> (just as we did for the table properties dialog which suffered the same
> issue).
> 
> To be complete, you have to know that even PostgreSQL truncates the
> query in the pg_stat_activity stats catalog. By default to 1024
> characters. So if your queries are longer than that, there's nothing we
> can do.
> 
> Working on a fix right now.
> 

OK, it's fixed now.

While working on this, I found another bug (you couldn't copy a query if
there was no application name for server 9.0+). Fixed too.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



Re: Query truncated in Server Status

From
Aren Cambre
Date:
Thanks! Yes, I am using Windows.

Aren

On Sun, Feb 19, 2012 at 5:12 AM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
On Sun, 2012-02-19 at 10:23 +0100, Guillaume Lelarge wrote:
> On Sat, 2012-02-18 at 18:54 -0600, Aren Cambre wrote:
> > In the Server Status program, long queries get truncated.
> >
> > Pressing Ctrl-C or the *Copy* button on a recent query put this in the
> > clipboard:
> > *9368 de 34132 postgres 6/528 AccessShareLock Yes 2012-02-18
> > 18:46:14.759-06 select
> > distinct case when upper(geometrytype("the_geom")) IN
> > ('POINT','MULTIPOINT') THEN 'POINT' when upper(geometrytype("the_geom")) IN
> > ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when
> > upper(geometrytype("the_geom")) IN ('POLYGON','MULTIPOLYG*
> > *
> > *
> > Looks like the query got truncated at the 250th character. I've reproduced
> > on other queries.
> >
> > I'm OK if the query needs to be truncated to fit in the UI, but the whole
> > query ought to be copied to the clipboard. This is making it challenging
> > for me to analyze a problematic Quantum GIS query.
> >
>
> I suppose you work on Windows. The widget we use on Windows truncates
> silently all strings to 512 characters. It means we need to fix this
> (just as we did for the table properties dialog which suffered the same
> issue).
>
> To be complete, you have to know that even PostgreSQL truncates the
> query in the pg_stat_activity stats catalog. By default to 1024
> characters. So if your queries are longer than that, there's nothing we
> can do.
>
> Working on a fix right now.
>

OK, it's fixed now.

While working on this, I found another bug (you couldn't copy a query if
there was no application name for server 9.0+). Fixed too.