Hi,

Please ignore previous patch, Attach is the updated patch which will cover

RM#2498 -  Handling of  bytea[] type.
RM#2502 -  Handling of  real & real[] type.

including their feature tests.

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

On Mon, Jun 19, 2017 at 9:58 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to fix the handling of  real type.
> RM#2502
>
> Steps to re-produce: Below given query fails to render result in Query
> tool,
> SELECT 'Infinity'::real, '{Infinity}'::real[]
>
> Also updated PG Data type feature test for the same.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/feature_tests/pg_datatype_validation_test.py 
b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
index b883aac..dff5c48 100644
--- a/web/pgadmin/feature_tests/pg_datatype_validation_test.py
+++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
@@ -80,24 +80,26 @@ class PGDataypeFeatureTest(BaseFeatureTest):
         self.page.toggle_open_tree_item(self.server['name'])
         self.page.toggle_open_tree_item('Databases')
         self.page.toggle_open_tree_item('acceptance_test_db')
-        self.page.toggle_open_tree_item('Schemas')
-        self.page.toggle_open_tree_item('public')
 
     def _check_datatype(self):
-        query = "SELECT -32767::smallint, 32767::smallint," \
-                "-2147483647::integer, 2147483647::integer," \
-                "9223372036854775807::bigint, 9223372036854775807::bigint," \
-                "922337203685.4775807::decimal, 92203685.477::decimal," \
-                "922337203685.922337203685::numeric, " \
-                "-92233720368547758.08::numeric," \
-                "ARRAY[1, 2, 3]::float[], ARRAY['nan', 'nan', 'nan']::float[];"
+        query = r"SELECT -32767::smallint, 32767::smallint," \
+                r"-2147483647::integer, 2147483647::integer," \
+                r"9223372036854775807::bigint, 9223372036854775807::bigint," \
+                r"922337203685.4775807::decimal, 92203685.477::decimal," \
+                r"922337203685.922337203685::numeric, " \
+                r"-92233720368547758.08::numeric," \
+                r"ARRAY[1, 2, 3]::float[], ARRAY['nan', 'nan', 
'nan']::float[]," \
+                r"'Infinity'::real, '{Infinity}'::real[]," \
+                r"E'\\xDEADBEEF'::bytea, ARRAY[E'\\xDEADBEEF', 
E'\\xDEADBEEF']::bytea[];"
 
         expected_output = [
             '-32767', '32767', '-2147483647', '2147483647',
             '9223372036854775807', '9223372036854775807',
             '922337203685.4775807', '92203685.477',
             '922337203685.922337203685', '-92233720368547758.08',
-            '{1,2,3}', '{NaN,NaN,NaN}'
+            '{1,2,3}', '{NaN,NaN,NaN}',
+            'Infinity', '{Infinity}',
+            r'\336\255\276\357', 
r'{"\\336\\255\\276\\357","\\336\\255\\276\\357"}'
         ]
 
         self.page.driver.find_element_by_link_text("Tools").click()
@@ -133,10 +135,17 @@ class PGDataypeFeatureTest(BaseFeatureTest):
         cnt = 12
         for val in expected_output[10:]:
             try:
-                source_code = self.page.find_by_xpath(
-                    "//*[@id='0']//*[@id='datagrid']/div[5]/div/div/div["
-                    + str(cnt)
+                if cnt == 14:
+                    xpath = 
"//*[@id='0']//*[@id='datagrid']/div[5]/div/div[1]/div[" \
+                    + str(cnt) \
+                    + "]/span"
+                else:
+                    xpath = 
"//*[@id='0']//*[@id='datagrid']/div[5]/div/div/div[" \
+                    + str(cnt) \
                     + "]"
+
+                source_code = self.page.find_by_xpath(
+                     xpath
                 ).get_attribute('innerHTML')
 
                 PGDataypeFeatureTest.check_result(
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 92562bc..876b887 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -60,8 +60,8 @@ psycopg2.extensions.register_type(
 psycopg2.extensions.register_type(
     psycopg2.extensions.new_type(
         (
-            # To cast bytea and interval type
-            17, 1186,
+            # To cast bytea, bytea[] and interval type
+            17, 1001, 1186,
 
             # to cast int4range, int8range, numrange tsrange, tstzrange,
             # daterange
@@ -70,8 +70,8 @@ psycopg2.extensions.register_type(
             # date, timestamp, timestamptz, bigint, double precision, bigint[]
             1700, 1082, 1114, 1184, 20, 701, 1016,
 
-            # double precision[]
-            1022
+            # double precision[], real, real[]
+            1022, 700, 1021
          ),
         'TYPECAST_TO_STRING', psycopg2.STRING)
 )

Reply via email to