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/23 08:10:48 UTC

[GitHub] [shardingsphere] peilinqian commented on issue #22355: The select result of ‘join with USING(column)’ exists problem;The column name and value doesn't match.

peilinqian commented on issue #22355:
URL: https://github.com/apache/shardingsphere/issues/22355#issuecomment-1324686097

   **There is problem,if this SQL only can be excuted in federation scenarios?
   two single table (one datasource) excuted with error**
   ```
   test_db=> preview select * from t_order22;
    data_source_name |       actual_sql
   ------------------+-------------------------
    ds_1             | select * from t_order22
   (1 row)
   
   test_db=> preview select * from t_order_item22;
    data_source_name |          actual_sql
   ------------------+------------------------------
    ds_1             | select * from t_order_item22
   (1 row)
   
   test_db=> SELECT * FROM t_order22 o RIGHT JOIN t_order_item22 i using(order_id) WHERE o.user_id = 10 ORDER BY o.order_id, 7;
   ERROR:  The column index is out of range: 12, number of columns: 11.
   test_db=>
   ```
   **Replace 'using' with 'on' ,the result is correct**
   ```
   test_db=> SELECT * FROM t_order22 o RIGHT JOIN t_order_item22 i on o.order_id = i.order_id WHERE o.user_id = 10 ORDER BY o.order_id, 7;
    order_id | user_id | status | merchant_id | remark |     creation_date     | item_id | order_id | user_id | product_id | quantity |     creation_date
   ----------+---------+--------+-------------+--------+-----------------------+---------+----------+---------+------------+----------+-----------------------
        1000 |      10 | init   |           1 | test   | 2017-07-08 00:00:00.0 |  100001 |     1000 |      10 |          1 |        1 | 2017-07-08 00:00:00.0
        1000 |      10 | init   |           1 | test   | 2017-07-08 00:00:00.0 |  100002 |     1000 |      10 |          1 |        1 | 2017-07-08 00:00:00.0
        1001 |      10 | init   |           2 | test   | 2017-07-08 00:00:00.0 |  100101 |     1001 |      10 |          2 |        1 | 2017-07-08 00:00:00.0
        1001 |      10 | init   |           2 | test   | 2017-07-08 00:00:00.0 |  100102 |     1001 |      10 |          2 |        1 | 2017-07-08 00:00:00.0
   (4 rows)
   ```
   
   


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