Mycatはピットエラー1064(HY000)を踏んでいます

Mycatはピットエラー1064(HY000)を踏んでいます

問題を再現する

Mycatが本番環境に新しく構築されました、クエリエラー:

mysql> select distinct o.* from
    ->         ( select goods_id offer_id, name offer_name, sn offer_code,simple_name,mktPrice,price,state,
    ->         thumbnail,type_id offer_type, marketing_begin_time,marketing_end_time,
    ->         t.tax
    ->         from  prod_goods t
    ->         where 1 = 1
    ->        and t.marketing_begin_time <= sysdate() 
    ->        and  t.marketing_end_time > sysdate())o
    -> ;
ERROR 1064 (HY000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*
LIMIT 100000000' at line 6

mysqlに直接接続している間、クエリは通常mycatなしで結果を返すことができます。

解決策

mycatはサポートしていませんselect distinct *ので、*具体的な列名を置き換えます。

mysql> select distinct offer_id,offer_name,offer_code,simple_name,mktPrice,price,state,thumbnail,offer_type,marketing_begin_time,marketing_end_time,tax from
    ->         ( select goods_id offer_id, name offer_name, sn offer_code,simple_name,mktPrice,price,state,
    ->         thumbnail,type_id offer_type, marketing_begin_time,marketing_end_time,
    ->         t.tax
    ->         from  prod_goods t
    ->         where 1 = 1
    ->        and t.marketing_begin_time <= sysdate() 
    ->        and  t.marketing_end_time > sysdate())o
    -> ;
+---------------------+-------------------------------+------------+-------------------------------+----------+-------+-------+-----------+------------+----------------------+---------------------+------+
| offer_id            | offer_name                    | offer_code | simple_name                   | mktPrice | price | state | thumbnail | offer_type | marketing_begin_time | marketing_end_time  | tax  |
+---------------------+-------------------------------+------------+-------------------------------+----------+-------+-------+-----------+------------+----------------------+---------------------+------+
| 1162487289697533953 | a                     | 12344      | a                    |    10000 |     1 | C     | NULL      | 6          | 2019-08-17 06:12:22  | 2019-09-16 06:12:22 | NULL |
| 1162487833723928578 | b                     | NULL       | b                    |        0 |     0 | C     | NULL      | 8          | 2019-08-17 06:14:42  | 2019-09-16 06:14:42 | NULL |
| 1162488027156840449 | c                     | NULL       | c                    |        0 |     0 | C     | NULL      | 6          | 2019-08-17 06:15:28  | 2019-09-16 06:15:28 | NULL |
| 1162488158606327810 | d                     | NULL       | d                    |        0 |     0 | C     | NULL      | 6          | 2019-08-17 06:15:59  | 2019-09-16 06:15:59 | NULL |
| 1162488323824156674 | e                     | NULL       | e                    |        0 |     0 | C     | NULL      | 6          | 2019-08-17 06:16:38  | 2019-09-16 06:16:38 | NULL |
+---------------------+-------------------------------+------------+-------------------------------+----------+-------+-------+-----------+------------+----------------------+---------------------+------+
5 rows in set (0.00 sec)

スクリプトは正常に実行されます

元の記事を136件公開 58のように 360,000以上を訪問

おすすめ

転載: blog.csdn.net/sunbocong/article/details/99716243