Re: [pgAdmin4][Patch]: RM#1352 - Problem displaying intervals and timestamps with pgAdmin 4

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: RM#1352 - Problem displaying intervals and timestamps with pgAdmin 4
Date: 2016-06-14 16:09:57
Message-ID: CA+OCxoy8L8SNxUAQVeWWK8c6TYQ+6MOGuWfWXALmwK9XhN5o1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Thanks, patch applied.

On Tue, Jun 14, 2016 at 8:55 AM, Surinder Kumar
<surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
> Hi,
>
> Please find the patch with issues fixed:
>
> 1) No handling for INTERVAL type datetime.
> For example: executing query
> SELECT INTERVAL '15 minutes';
> throws json serialization error, because it returns time in timedelta format
> which is not handled.
>
> Added support to handle timedelta datetime format in DataTypeJSONEncoder
> class
>
> 2) When we try to get BC dates from database raises ValueError: year is out
> of range
> For eg:
> SELECT TIMESTAMP '0044-03-15 10:00:00 BC',
> It is because pyscopg2 doesn't handle BC datetime format.
>
> So we have defined our method which type cast the datetime value to string
> in pyscopg2 overriding default behaviour.
>
> Reference:
> http://initd.org/psycopg/docs/advanced.html#type-casting-from-sql-to-python
> https://github.com/dbcli/pgcli/blob/ccf3693be62dd8a79ced19ed9d69f0708d2b3d6f/pgcli/pgexecute.py
>
> Issue left:
> Pyscopg2 not handling representation of BC dates. It is currently
> representing time in following query
> SELECT TIMESTAMPTZ '2016-03-15 10:00:00+02 AD';
> as
> 2016-03-15T00:00:00Z
> which is wrong.
> I will send patch for it when gets fixed.
>
> Please review.
>
>
> Thanks,
> Surinder Kumar
>
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>

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

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

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2016-06-14 16:23:29 pgAdmin 4 commit: Added connect now option in server create dialog. Fix
Previous Message Dave Page 2016-06-14 16:09:50 pgAdmin 4 commit: Resolve problem displaying intervals and timestamps.