public inbox for [email protected]  
help / color / mirror / Atom feed
PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
7+ messages / 2 participants
[nested] [flat]

* PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-14 09:06  Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Murtuza Zabuawala @ 2016-07-14 09:06 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

PFA patch to fix the issue where if user use cast function and it causes
freeze in query tool.
(RM#1438)

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM_1438.patch (1.0K, 3-RM_1438.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index 5fb07c3..6c8e582 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -1525,7 +1525,14 @@ define(
                       col_type = '';
                   label_text.innerText = c.name;
 
-                  var type = pg_types[c.type_code][0];
+                  var type = pg_types[c.type_code] ?
+                               pg_types[c.type_code][0] :
+                               // This is the case where user might
+                               // have use casting so we will use type
+                               // returned by cast function
+                               pg_types[pg_types.length - 1][0] ?
+                                 pg_types[pg_types.length - 1][0] : 'unknown';
+
                   if (!is_primary_key)
                     col_type += ' ' + type;
                   else


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-15 11:07  Dave Page <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Dave Page @ 2016-07-15 11:07 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

On Thu, Jul 14, 2016 at 10:06 AM, Murtuza Zabuawala
<[email protected]> wrote:
> Hi,
>
> PFA patch to fix the issue where if user use cast function and it causes
> freeze in query tool.
> (RM#1438)

This fixes the hang, but then displays the wrong data type for the
first column - e.g.

SELECT CURRENT_TIMESTAMP, CAST ( CURRENT_TIMESTAMP AS text ) ;

will show the columns as "now text(8)" and "now text", when it should
be "now timestamp with time zone", "now text"

Note that SELECT CURRENT_TIMESTAMP also gets this a little wrong - it
shows "now timestamp with time zone(8)" (the size shouldn't be
included)


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-15 11:44  Murtuza Zabuawala <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Murtuza Zabuawala @ 2016-07-15 11:44 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

Hi Dave,

Yes, I am aware of that, but the issue you mentioned is due to psycopg2
DictCursor issue which I have already mentioned earlier (RM#1409)
https://github.com/psycopg/psycopg2/issues/454.

The patch is for different issue (RM#1438).

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Jul 15, 2016 at 4:37 PM, Dave Page <[email protected]> wrote:

> On Thu, Jul 14, 2016 at 10:06 AM, Murtuza Zabuawala
> <[email protected]> wrote:
> > Hi,
> >
> > PFA patch to fix the issue where if user use cast function and it causes
> > freeze in query tool.
> > (RM#1438)
>
> This fixes the hang, but then displays the wrong data type for the
> first column - e.g.
>
> SELECT CURRENT_TIMESTAMP, CAST ( CURRENT_TIMESTAMP AS text ) ;
>
> will show the columns as "now text(8)" and "now text", when it should
> be "now timestamp with time zone", "now text"
>
> Note that SELECT CURRENT_TIMESTAMP also gets this a little wrong - it
> shows "now timestamp with time zone(8)" (the size shouldn't be
> included)
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-15 11:49  Murtuza Zabuawala <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Murtuza Zabuawala @ 2016-07-15 11:49 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

++ FYI,

If you provide alias, it'll give you proper result :)

SELECT CURRENT_TIMESTAMP as ts, CAST ( CURRENT_TIMESTAMP AS text ) as
ts_as_text;


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Jul 15, 2016 at 5:14 PM, Murtuza Zabuawala <
[email protected]> wrote:

> Hi Dave,
>
> Yes, I am aware of that, but the issue you mentioned is due to psycopg2
> DictCursor issue which I have already mentioned earlier (RM#1409)
> https://github.com/psycopg/psycopg2/issues/454.
>
> The patch is for different issue (RM#1438).
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Fri, Jul 15, 2016 at 4:37 PM, Dave Page <[email protected]> wrote:
>
>> On Thu, Jul 14, 2016 at 10:06 AM, Murtuza Zabuawala
>> <[email protected]> wrote:
>> > Hi,
>> >
>> > PFA patch to fix the issue where if user use cast function and it causes
>> > freeze in query tool.
>> > (RM#1438)
>>
>> This fixes the hang, but then displays the wrong data type for the
>> first column - e.g.
>>
>> SELECT CURRENT_TIMESTAMP, CAST ( CURRENT_TIMESTAMP AS text ) ;
>>
>> will show the columns as "now text(8)" and "now text", when it should
>> be "now timestamp with time zone", "now text"
>>
>> Note that SELECT CURRENT_TIMESTAMP also gets this a little wrong - it
>> shows "now timestamp with time zone(8)" (the size shouldn't be
>> included)
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-15 11:57  Dave Page <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Dave Page @ 2016-07-15 11:57 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

OK, so the type names are affected by the duplicate column names, and
need to be avoided by using indexes and avoiding dicts. That's issue
#1409.

The second issue is that "SELECT CURRENT_TIMESTAMP" gives us "now
timestamp with time zone (8)". Is the (8) also part of issue #1409, or
some other bug?

The third issue is fixed by this patch, so I'll commit that as there's
a ticket for the other bit already).

On Fri, Jul 15, 2016 at 12:49 PM, Murtuza Zabuawala
<[email protected]> wrote:
> ++ FYI,
>
> If you provide alias, it'll give you proper result :)
>
> SELECT CURRENT_TIMESTAMP as ts, CAST ( CURRENT_TIMESTAMP AS text ) as
> ts_as_text;
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Fri, Jul 15, 2016 at 5:14 PM, Murtuza Zabuawala
> <[email protected]> wrote:
>>
>> Hi Dave,
>>
>> Yes, I am aware of that, but the issue you mentioned is due to psycopg2
>> DictCursor issue which I have already mentioned earlier (RM#1409)
>> https://github.com/psycopg/psycopg2/issues/454.
>>
>> The patch is for different issue (RM#1438).
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Fri, Jul 15, 2016 at 4:37 PM, Dave Page <[email protected]> wrote:
>>>
>>> On Thu, Jul 14, 2016 at 10:06 AM, Murtuza Zabuawala
>>> <[email protected]> wrote:
>>> > Hi,
>>> >
>>> > PFA patch to fix the issue where if user use cast function and it
>>> > causes
>>> > freeze in query tool.
>>> > (RM#1438)
>>>
>>> This fixes the hang, but then displays the wrong data type for the
>>> first column - e.g.
>>>
>>> SELECT CURRENT_TIMESTAMP, CAST ( CURRENT_TIMESTAMP AS text ) ;
>>>
>>> will show the columns as "now text(8)" and "now text", when it should
>>> be "now timestamp with time zone", "now text"
>>>
>>> Note that SELECT CURRENT_TIMESTAMP also gets this a little wrong - it
>>> shows "now timestamp with time zone(8)" (the size shouldn't be
>>> included)
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>
>>
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-15 12:25  Murtuza Zabuawala <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Murtuza Zabuawala @ 2016-07-15 12:25 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

On Fri, Jul 15, 2016 at 5:27 PM, Dave Page <[email protected]> wrote:

> OK, so the type names are affected by the duplicate column names, and
> need to be avoided by using indexes and avoiding dicts. That's issue
> #1409.
>
> The second issue is that "SELECT CURRENT_TIMESTAMP" gives us "now
> timestamp with time zone (8)". Is the (8) also part of issue #1409, or
> some other bug?
>
> (I though it's by design that we are displaying size with every column)
But this is not related to RM#1409 or RM#1438.


> The third issue is fixed by this patch, so I'll commit that as there's
> a ticket for the other bit already).
>
> On Fri, Jul 15, 2016 at 12:49 PM, Murtuza Zabuawala
> <[email protected]> wrote:
> > ++ FYI,
> >
> > If you provide alias, it'll give you proper result :)
> >
> > SELECT CURRENT_TIMESTAMP as ts, CAST ( CURRENT_TIMESTAMP AS text ) as
> > ts_as_text;
> >
> >
> > --
> > Regards,
> > Murtuza Zabuawala
> > EnterpriseDB: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> > On Fri, Jul 15, 2016 at 5:14 PM, Murtuza Zabuawala
> > <[email protected]> wrote:
> >>
> >> Hi Dave,
> >>
> >> Yes, I am aware of that, but the issue you mentioned is due to psycopg2
> >> DictCursor issue which I have already mentioned earlier (RM#1409)
> >> https://github.com/psycopg/psycopg2/issues/454.
> >>
> >> The patch is for different issue (RM#1438).
> >>
> >> --
> >> Regards,
> >> Murtuza Zabuawala
> >> EnterpriseDB: http://www.enterprisedb.com
> >> The Enterprise PostgreSQL Company
> >>
> >> On Fri, Jul 15, 2016 at 4:37 PM, Dave Page <[email protected]> wrote:
> >>>
> >>> On Thu, Jul 14, 2016 at 10:06 AM, Murtuza Zabuawala
> >>> <[email protected]> wrote:
> >>> > Hi,
> >>> >
> >>> > PFA patch to fix the issue where if user use cast function and it
> >>> > causes
> >>> > freeze in query tool.
> >>> > (RM#1438)
> >>>
> >>> This fixes the hang, but then displays the wrong data type for the
> >>> first column - e.g.
> >>>
> >>> SELECT CURRENT_TIMESTAMP, CAST ( CURRENT_TIMESTAMP AS text ) ;
> >>>
> >>> will show the columns as "now text(8)" and "now text", when it should
> >>> be "now timestamp with time zone", "now text"
> >>>
> >>> Note that SELECT CURRENT_TIMESTAMP also gets this a little wrong - it
> >>> shows "now timestamp with time zone(8)" (the size shouldn't be
> >>> included)
> >>>
> >>>
> >>> --
> >>> Dave Page
> >>> Blog: http://pgsnake.blogspot.com
> >>> Twitter: @pgsnake
> >>>
> >>> EnterpriseDB UK: http://www.enterprisedb.com
> >>> The Enterprise PostgreSQL Company
> >>
> >>
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)
@ 2016-07-15 12:35  Dave Page <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Dave Page @ 2016-07-15 12:35 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

On Fri, Jul 15, 2016 at 1:25 PM, Murtuza Zabuawala
<[email protected]> wrote:
>
>
> On Fri, Jul 15, 2016 at 5:27 PM, Dave Page <[email protected]> wrote:
>>
>> OK, so the type names are affected by the duplicate column names, and
>> need to be avoided by using indexes and avoiding dicts. That's issue
>> #1409.
>>
>> The second issue is that "SELECT CURRENT_TIMESTAMP" gives us "now
>> timestamp with time zone (8)". Is the (8) also part of issue #1409, or
>> some other bug?
>>
> (I though it's by design that we are displaying size with every column)

Definitely not - it's a bug. Only types that take size parameters
should display them.

> But this is not related to RM#1409 or RM#1438.
>
>>
>> The third issue is fixed by this patch, so I'll commit that as there's
>> a ticket for the other bit already).
>>
>> On Fri, Jul 15, 2016 at 12:49 PM, Murtuza Zabuawala
>> <[email protected]> wrote:
>> > ++ FYI,
>> >
>> > If you provide alias, it'll give you proper result :)
>> >
>> > SELECT CURRENT_TIMESTAMP as ts, CAST ( CURRENT_TIMESTAMP AS text ) as
>> > ts_as_text;
>> >
>> >
>> > --
>> > Regards,
>> > Murtuza Zabuawala
>> > EnterpriseDB: http://www.enterprisedb.com
>> > The Enterprise PostgreSQL Company
>> >
>> > On Fri, Jul 15, 2016 at 5:14 PM, Murtuza Zabuawala
>> > <[email protected]> wrote:
>> >>
>> >> Hi Dave,
>> >>
>> >> Yes, I am aware of that, but the issue you mentioned is due to psycopg2
>> >> DictCursor issue which I have already mentioned earlier (RM#1409)
>> >> https://github.com/psycopg/psycopg2/issues/454.
>> >>
>> >> The patch is for different issue (RM#1438).
>> >>
>> >> --
>> >> Regards,
>> >> Murtuza Zabuawala
>> >> EnterpriseDB: http://www.enterprisedb.com
>> >> The Enterprise PostgreSQL Company
>> >>
>> >> On Fri, Jul 15, 2016 at 4:37 PM, Dave Page <[email protected]> wrote:
>> >>>
>> >>> On Thu, Jul 14, 2016 at 10:06 AM, Murtuza Zabuawala
>> >>> <[email protected]> wrote:
>> >>> > Hi,
>> >>> >
>> >>> > PFA patch to fix the issue where if user use cast function and it
>> >>> > causes
>> >>> > freeze in query tool.
>> >>> > (RM#1438)
>> >>>
>> >>> This fixes the hang, but then displays the wrong data type for the
>> >>> first column - e.g.
>> >>>
>> >>> SELECT CURRENT_TIMESTAMP, CAST ( CURRENT_TIMESTAMP AS text ) ;
>> >>>
>> >>> will show the columns as "now text(8)" and "now text", when it should
>> >>> be "now timestamp with time zone", "now text"
>> >>>
>> >>> Note that SELECT CURRENT_TIMESTAMP also gets this a little wrong - it
>> >>> shows "now timestamp with time zone(8)" (the size shouldn't be
>> >>> included)
>> >>>
>> >>>
>> >>> --
>> >>> Dave Page
>> >>> Blog: http://pgsnake.blogspot.com
>> >>> Twitter: @pgsnake
>> >>>
>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>> >>> The Enterprise PostgreSQL Company
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2016-07-15 12:35 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 09:06 PATCH: To fix the issue where cast function causes freeze (pgAdmin4) Murtuza Zabuawala <[email protected]>
2016-07-15 11:07 ` Dave Page <[email protected]>
2016-07-15 11:44   ` Murtuza Zabuawala <[email protected]>
2016-07-15 11:49     ` Murtuza Zabuawala <[email protected]>
2016-07-15 11:57       ` Dave Page <[email protected]>
2016-07-15 12:25         ` Murtuza Zabuawala <[email protected]>
2016-07-15 12:35           ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox