Yiluhuakai22 opened a new issue, #28938:
URL: https://github.com/apache/shardingsphere/issues/28938

   When django connects directly to PG, execute python manage.py migrate and 
everything works fine. But when django adds shardingsphere-proxy, executing 
command return an error
   
   ```
   environment:
   
   -   Django 3.2.12
   -   psycopg2-binary 2.8.6
   -   psycopg2-binary 2.8.6
   -   apache/shardingsphere-proxy 5.4.1
   -   postgres 11.14
   ```
   ```
   exception detail:
   
   Traceback (most recent call last):
     File 
"/data/code/dtmg/.env/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
       self.connect()
     File 
"/data/code/dtmg/.env/lib/python3.9/site-packages/django/utils/asyncio.py", 
line 33, in inner
       return func(*args, **kwargs)
     File 
"/data/code/dtmg/.env/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 202, in connect
       self.init_connection_state()
     File 
"/data/code/dtmg/.env/lib/python3.9/site-packages/django/db/backends/postgresql/base.py",
 line 224, in init_connection_state
       timezone_changed = self.ensure_timezone()
     File 
"/data/code/dtmg/.env/lib/python3.9/site-packages/django/db/backends/postgresql/base.py",
 line 217, in ensure_timezone
       cursor.execute(self.ops.set_time_zone_sql(), [timezone_name])
   psycopg2.errors.SystemError: Unknown exception: null
   ```
   PG timezone is Asia/Shanghai
   ```
   sharding_db=> show time zone;
    timezone 
   ----------
    Etc/UTC
   (1 row)
   ```
   and in  ensure_timezone function:
   ```
   def ensure_timezone(self):
           if self.connection is None:
               return False
           # conn_timezone_name = None
           conn_timezone_name = self.connection.get_parameter_status('TimeZone')
           timezone_name = self.timezone_name
           if timezone_name and conn_timezone_name != timezone_name:
               with self.connection.cursor() as cursor:
                   cursor.execute(self.ops.set_time_zone_sql(), [timezone_name])
               return True
           return False
   ```
   conn_timezone_name = None
   
   I can't find a solution. If anyone can help, thank you very much


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to