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..b8e0959 100644
--- a/web/pgadmin/feature_tests/pg_datatype_validation_test.py
+++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
@@ -90,14 +90,16 @@ class PGDataypeFeatureTest(BaseFeatureTest):
                 "922337203685.4775807::decimal, 92203685.477::decimal," \
                 "922337203685.922337203685::numeric, " \
                 "-92233720368547758.08::numeric," \
-                "ARRAY[1, 2, 3]::float[], ARRAY['nan', 'nan', 'nan']::float[];"
+                "ARRAY[1, 2, 3]::float[], ARRAY['nan', 'nan', 
'nan']::float[]," \
+                "'Infinity'::real, '{Infinity}'::real[];"
 
         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}'
         ]
 
         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..0e110b7 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -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