You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Yiluhuakai22 (via GitHub)" <gi...@apache.org> on 2023/11/04 08:48:02 UTC

[I] An error occurred on the migration command in dajngo with Sharding-Proxy to connect postgresql [shardingsphere]

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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] An error occurred on the migration command in dajngo throungt Sharding-Proxy to connect postgresql [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #28938:
URL: https://github.com/apache/shardingsphere/issues/28938#issuecomment-1839389901

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] An error occurred on the migration command in dajngo throungt Sharding-Proxy to connect postgresql [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #28938:
URL: https://github.com/apache/shardingsphere/issues/28938#issuecomment-2241759434

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org