Subject: PATCH: To fix the issue where cast function causes freeze (pgAdmin4)

From: Murtuza Zabuawala <[email-masked]>
Date: Thu, 14 Jul 2016 14:36:17 +0530

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-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

---

From: Dave Page <[email-masked]>
Date: Fri, 15 Jul 2016 12:07:45 +0100

> PFA patch to fix the issue where if user use cast function and it causes

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

---

From: Murtuza Zabuawala <[email-masked]>
Date: Fri, 15 Jul 2016 17:14:16 +0530

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).

---

From: Murtuza Zabuawala <[email-masked]>
Date: Fri, 15 Jul 2016 17:19:35 +0530

++ 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;

---

From: Dave Page <[email-masked]>
Date: Fri, 15 Jul 2016 12:57:53 +0100

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-masked]> wrote:
> On Fri, Jul 15, 2016 at 5:14 PM, Murtuza Zabuawala

---

From: Murtuza Zabuawala <[email-masked]>
Date: Fri, 15 Jul 2016 17:55:57 +0530

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

> (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.

---

From: Dave Page <[email-masked]>
Date: Fri, 15 Jul 2016 13:35:55 +0100

> (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.