You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/30 02:49:09 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue, #22516: PostgreSQL Proxy behavior different with PostgreSQL when doing math

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   master - 935a8108a6e411cab79c7861fe1d7315d27f941c
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy PostgreSQL
   
   ### Expected behavior
   
   ```
   psql -h 127.0.0.1 -p 5432 -Upostgres -c 'select n, 10.0 ^ n as "10^n", (10.0 ^ n) * (10.0 ^ (-n)) = 1 as ok from generate_series(-20, 20) n;'          [~]
     n  |                  10^n                  | ok 
   -----+----------------------------------------+----
    -20 |                     0.0000000000000000 | f
    -19 |                     0.0000000000000000 | f
    -18 |                     0.0000000000000000 | f
    -17 |                     0.0000000000000000 | f
    -16 |                     0.0000000000000001 | t
    -15 |                     0.0000000000000010 | t
    -14 |                     0.0000000000000100 | t
    -13 |                     0.0000000000001000 | t
    -12 |                     0.0000000000010000 | t
    -11 |                     0.0000000000100000 | t
    -10 |                     0.0000000001000000 | t
     -9 |                     0.0000000010000000 | t
     -8 |                     0.0000000100000000 | t
     -7 |                     0.0000001000000000 | t
     -6 |                     0.0000010000000000 | t
     -5 |                     0.0000100000000000 | t
     -4 |                     0.0001000000000000 | t
     -3 |                     0.0010000000000000 | t
     -2 |                     0.0100000000000000 | t
     -1 |                     0.1000000000000000 | t
      0 |                     1.0000000000000000 | t
      1 |                    10.0000000000000000 | t
      2 |                   100.0000000000000000 | t
      3 |                  1000.0000000000000000 | t
      4 |                 10000.0000000000000000 | t
      5 |                100000.0000000000000000 | t
      6 |               1000000.0000000000000000 | t
      7 |              10000000.0000000000000000 | t
      8 |             100000000.0000000000000000 | t
      9 |            1000000000.0000000000000000 | t
     10 |           10000000000.0000000000000000 | t
     11 |          100000000000.0000000000000000 | t
     12 |         1000000000000.0000000000000000 | t
     13 |        10000000000000.0000000000000000 | t
     14 |       100000000000000.0000000000000000 | t
     15 |      1000000000000000.0000000000000000 | t
     16 |     10000000000000000.0000000000000000 | t
     17 |    100000000000000000.0000000000000000 | f
     18 |   1000000000000000000.0000000000000000 | f
     19 |  10000000000000000000.0000000000000000 | f
     20 | 100000000000000000000.0000000000000000 | f
   (41 rows)
   
   ```
   
   
   ### Actual behavior
   
   ```
   psql -h 127.0.0.1 -p 55432 -Upostgres -c 'select n, 10.0 ^ n as "10^n", (10.0 ^ n) * (10.0 ^ (-n)) = 1 as ok from generate_series(-20, 20) n;'         [~]
   Password for user postgres: 
     n  |                  10^n                  |  ok   
   -----+----------------------------------------+-------
    -20 |                                  0E-16 | false
    -19 |                                  0E-16 | false
    -18 |                                  0E-16 | false
    -17 |                                  0E-16 | false
    -16 |                                  1E-16 | true
    -15 |                                1.0E-15 | true
    -14 |                               1.00E-14 | true
    -13 |                              1.000E-13 | true
    -12 |                             1.0000E-12 | true
    -11 |                            1.00000E-11 | true
    -10 |                           1.000000E-10 | true
     -9 |                           1.0000000E-9 | true
     -8 |                          1.00000000E-8 | true
     -7 |                         1.000000000E-7 | true
     -6 |                     0.0000010000000000 | true
     -5 |                     0.0000100000000000 | true
     -4 |                     0.0001000000000000 | true
     -3 |                     0.0010000000000000 | true
     -2 |                     0.0100000000000000 | true
     -1 |                     0.1000000000000000 | true
      0 |                     1.0000000000000000 | true
      1 |                    10.0000000000000000 | true
      2 |                   100.0000000000000000 | true
      3 |                  1000.0000000000000000 | true
      4 |                 10000.0000000000000000 | true
      5 |                100000.0000000000000000 | true
      6 |               1000000.0000000000000000 | true
      7 |              10000000.0000000000000000 | true
      8 |             100000000.0000000000000000 | true
      9 |            1000000000.0000000000000000 | true
     10 |           10000000000.0000000000000000 | true
     11 |          100000000000.0000000000000000 | true
     12 |         1000000000000.0000000000000000 | true
     13 |        10000000000000.0000000000000000 | true
     14 |       100000000000000.0000000000000000 | true
     15 |      1000000000000000.0000000000000000 | true
     16 |     10000000000000000.0000000000000000 | true
     17 |    100000000000000000.0000000000000000 | false
     18 |   1000000000000000000.0000000000000000 | false
     19 |  10000000000000000000.0000000000000000 | false
     20 | 100000000000000000000.0000000000000000 | false
   ```
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   No rules configured.
   
   ```sql
   select n, 10.0 ^ n as "10^n", (10.0 ^ n) * (10.0 ^ (-n)) = 1 as ok from generate_series(-20, 20) n
   ```
   
   
   ### Reason analyze (If you can)
   
   PostgreSQL
   
   ![image](https://user-images.githubusercontent.com/20503072/204695691-0861b687-b0e9-47da-91d7-5d19f57923f3.png)
   
   
   ShardingSphere-Proxy PostgreSQL
   
   ![image](https://user-images.githubusercontent.com/20503072/204695729-e6589513-c42f-4bdd-b9bb-e19a1974d757.png)
   


-- 
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


[GitHub] [shardingsphere] TeslaCN commented on issue #22516: PostgreSQL Proxy behavior different with PostgreSQL when doing math

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22516:
URL: https://github.com/apache/shardingsphere/issues/22516#issuecomment-1364937682

   Data format is different, but this doesn't affect JDBC. JDBC could decode data into correct object.


-- 
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