mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where CSV download quotes the numeric columns. Fixes #6341
This commit is contained in:
parent
8ae8fea6d2
commit
5894001eb2
@ -17,4 +17,5 @@ Housekeeping
|
||||
Bug fixes
|
||||
*********
|
||||
|
||||
| `Issue #6341 <https://redmine.postgresql.org/issues/6341>`_ - Fixed an issue where CSV download quotes the numeric columns.
|
||||
| `Issue #6385 <https://redmine.postgresql.org/issues/6385>`_ - Ensure that Backup and Restore should work on shared servers.
|
||||
|
@ -30,7 +30,7 @@ from pgadmin.utils.exception import ConnectionLost, CryptKeyMissing
|
||||
from pgadmin.utils import get_complete_file_path
|
||||
from ..abstract import BaseConnection
|
||||
from .cursor import DictCursor
|
||||
from .typecast import register_global_typecasters, \
|
||||
from .typecast import register_float_typecasters, register_global_typecasters,\
|
||||
register_string_typecasters, register_binary_typecasters, \
|
||||
unregister_numeric_typecasters, \
|
||||
register_array_to_string_typecasters, ALL_JSON_TYPES
|
||||
@ -462,6 +462,7 @@ class Connection(BaseConnection):
|
||||
self._set_auto_commit(kwargs)
|
||||
|
||||
register_string_typecasters(self.conn)
|
||||
register_float_typecasters(self.conn)
|
||||
|
||||
if self.array_to_string:
|
||||
register_array_to_string_typecasters(self.conn)
|
||||
@ -911,6 +912,8 @@ WHERE db.datname = current_database()""")
|
||||
|
||||
# Registering back type caster for large size data types to string
|
||||
# which was unregistered at starting
|
||||
if any(type['type_code'] == 701 for type in self.column_info):
|
||||
register_float_typecasters(self.conn)
|
||||
register_string_typecasters(self.conn)
|
||||
return True, gen
|
||||
|
||||
|
@ -13,6 +13,7 @@ data types.
|
||||
"""
|
||||
|
||||
from psycopg2 import STRING as _STRING
|
||||
from psycopg2.extensions import FLOAT as _FLOAT
|
||||
from psycopg2.extensions import DECIMAL as _DECIMAL, encodings
|
||||
import psycopg2
|
||||
from psycopg2.extras import Json as psycopg2_json
|
||||
@ -203,6 +204,14 @@ def register_string_typecasters(connection):
|
||||
psycopg2.extensions.register_type(unicode_array_type, connection)
|
||||
|
||||
|
||||
def register_float_typecasters(connection):
|
||||
# This function is to convert pg types into decimal type
|
||||
string_type_to_float = \
|
||||
psycopg2.extensions.new_type(TO_STRING_NUMERIC_DATATYPES,
|
||||
'TYPECAST_TO_DECIMAL', _DECIMAL)
|
||||
psycopg2.extensions.register_type(string_type_to_float, connection)
|
||||
|
||||
|
||||
def register_binary_typecasters(connection):
|
||||
psycopg2.extensions.register_type(
|
||||
psycopg2.extensions.new_type(
|
||||
|
Loading…
Reference in New Issue
Block a user