pgAdmin 4 commit: Resolve problem displaying intervals and timestamps. - Mailing list pgadmin-hackers

From Dave Page
Subject pgAdmin 4 commit: Resolve problem displaying intervals and timestamps.
Date
Msg-id E1bCquU-00026o-LJ@gothos.postgresql.org
Whole thread Raw
List pgadmin-hackers
Resolve problem displaying intervals and timestamps. Fixes #1352

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

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=5dbbd8e638a6c4c4d1df4203cd70a6bd92350ab6
Author: Surinder Kumar <surinder.kumar@enterprisedb.com>

Modified Files
--------------
web/pgadmin/utils/ajax.py                     |  2 ++
web/pgadmin/utils/driver/psycopg2/__init__.py | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+)


pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: PATCH: To have validation messages on status panel only (pgAdmin4)
Next
From: Dave Page
Date:
Subject: Re: [pgAdmin4][Patch]: RM#1352 - Problem displaying intervals and timestamps with pgAdmin 4